snyk-config

WebJar for snyk-config

Лицензия

Лицензия

Категории

Категории

config Библиотеки уровня приложения Configuration
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

snyk-config
Последняя версия

Последняя версия

2.2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

snyk-config
WebJar for snyk-config
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/snyk/config

Скачать snyk-config

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/snyk-config/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>snyk-config</artifactId>
    <version>2.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/snyk-config/
implementation 'org.webjars.npm:snyk-config:2.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/snyk-config/
implementation ("org.webjars.npm:snyk-config:2.2.0")
'org.webjars.npm:snyk-config:jar:2.2.0'
<dependency org="org.webjars.npm" name="snyk-config" rev="2.2.0">
  <artifact name="snyk-config" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='snyk-config', version='2.2.0')
)
libraryDependencies += "org.webjars.npm" % "snyk-config" % "2.2.0"
[org.webjars.npm/snyk-config "2.2.0"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
org.webjars.npm : debug jar [3.1.0,4)
org.webjars.npm : lodash jar [4.17.5,5)
org.webjars.npm : nconf jar [0.10.0,0.11)

Модули Проекта

Данный проект не имеет модулей.

snyk-config

Loads the configuration for your module.

Usage

Although you can require this module directly, it's recommended you create your own config.ts file that can be cached by the require system and called without a path:

// config.ts
import { loadConfig } from 'snyk-config';
export const config = loadConfig('<directory with config files>');

// in app.ts
import { config } from './config';

// in foo.ts
import { config } from './config'; // matches config in app.ts

Method

The config loader will look for the following values in order of priority, specifically, if a property appears in multiple layers of config (below) the first found is used:

  • process environment values prefixed with SNYK_
  • process arguments
  • a config.secret.json file in the path specified by:
    • the secretConfig option, or
    • the environment variable CONFIG_SECRET_FILE, or
    • in the specified config directory
  • a config.${SERVICE_ENV}.json file in the specified config directory,
    • where SERVICE_ENV defaults to local, if not set
  • a config.default.json file in the specified config directory

Example

config.local.json

{
  "from": "file"
}

app.js

import { loadConfig } from 'snyk-config';
// as we're in the same directory as the config.local.json, there's no arg
const config = loadConfig();
console.log(config);

cli

$ SNYK_from=cli node app.js
=> { from: "cli" }

Notes

  • Values read from the environment or from the process arguments will always be strings or booleans. This is important to differentiate from values parsed in the config files as these can be numbers.
  • Environment property names strip off the preceding SNYK_ string, so SNYK_foo = 10 becomes foo = "10"
  • To create a nested object structure from the environment values, use two underscores: SNYK_foo__bar = 10 becomes foo = { bar: "10" }
org.webjars.npm

Snyk

Continuously find & fix vulnerabilities in dependencies pulled from npm, Maven, RubyGems, PyPI and more

Версии библиотеки

Версия
2.2.0