Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@teamteanpm2024/ut-quia-ad

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teamteanpm2024/ut-quia-ad

@teamteanpm2024/ut-quia-ad ----

  • 3.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

@teamteanpm2024/ut-quia-ad

Converts process.env into a neatly packed object.

Usage

import config from '@teamteanpm2024/ut-quia-ad';

const myConfig = await config();

What it does

It turns the environment variables below...

API_PORT=3000
API_BASE_URL="http://api.myapp.com/"
API_AUTH_TOKEN=myauthtoken
API_USER_KEYS_0="key1"
API_USER_KEYS_1="key2"
API_USER_KEYS_2="key3"

...into the data below.

{
	api: {
		port: '3000',
		baseUrl: 'http://api.myapp.com',
		authToken: 'myauthtoken',
		userKeys: [
			'key1',
			'key2',
			'key3'
		]
	}
}

Validation

The isvalid package is build into the library and can be used to validate the configuration.

See the documentation for isvalid on how to format the schema.

Example

const myConfig = await config({
	'port': {
		type: Number,
		required: true,
		range: '-65535'
	}
}, /* options = { defaults: { unknownKeys: 'allow' } } */);

The above example will throw an error if the data cannot be validated. It will, though, because of the way isvalid works, convert the port to a Number.

See the isvalid documentation for available options.

The comment in the example is there to show what options config uses per default.

License

See license in LICENSE.

Keywords

FAQs

Package last updated on 29 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc