-
Notifications
You must be signed in to change notification settings - Fork 0
ConfigurationOptions
Michael J. Ryan edited this page May 20, 2015
·
2 revisions
var azureUtil = require('azure-config-util')(options);
-
account- The connectionString, or named azure storage account to use. -
accountKey- The access key for the named azure storage account. -
accountTable- The Azure Storage Table to use for configuration Settings -
namespace- The application/suite namespace to use. -
environment- The runtime environment.
In order to protect your access to the configuration table, you may execute your programs using the following environment variables in place of explicit configuration options.
-
CONFIG_OPTIONS- JSON string representing all the configuration options as a single object.{account,accountKey,accountTable,namespace,environment}
-
CONFIG_ACCOUNT- The name of the account or connection string to use.- Fall back to
AZURE_STORAGE_ACCOUNT
- Fall back to
-
CONFIG_ACCOUNT_KEY- The key for a named account, or unset when using a connection string.- Fall back to
AZURE_STORAGE_ACCESS_KEY
- Fall back to
-
CONFIG_TABLE- The name of the azure storage table to use for configuration data.- Defaults to
"config".
- Defaults to
-
CONFIG_NS- The application/suite namespace to use. Defaults to"default" -
CONFIG_ENV- The environment to use.- Fall back to
NODE_ENV - Default to
"local"
- Fall back to
You can set global defaults programmatically with:
require('azure-config-util/options').set(options)Order of precedence for options passed into the environment.
var d = getGlobalDefaults(); //globally configured defaults
var e = process.env;
var c = JSON.parse(e.CONFIG_OPTIONS || '{}')
var o = passedInOptions;
return {
account: o.account ||
d.account ||
e.CONFIG_ACCOUNT ||
c.account ||
e.AZURE_STORAGE_ACCOUNT ||
null,
accountKey: o.accountKey ||
d.accountKey ||
e.CONFIG_ACCOUNT_KEY ||
c.accountKey ||
e.AZURE_STORAGE_ACCESS_KEY ||
null,
accountTable: o.accountTable ||
d.accountTable ||
e.CONFIG_TABLE ||
c.accountTable ||
'config',
namespace: o.namespace ||
d.namespace ||
e.CONFIG_NS ||
c.namespace ||
'default',
environment: o.environment ||
d.environment ||
e.CONFIG_ENV ||
c.environment ||
process.env.NODE_ENV ||
'local'
};