@achs/env 4.0.1 → 4.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arguments.d.ts +25 -25
- package/arguments.js +125 -125
- package/commands/env.command.d.ts +7 -7
- package/commands/env.command.js +78 -78
- package/commands/export.command.d.ts +7 -7
- package/commands/export.command.js +53 -53
- package/commands/index.d.ts +5 -5
- package/commands/index.js +13 -13
- package/commands/pull.command.d.ts +6 -6
- package/commands/pull.command.js +38 -38
- package/commands/push.command.d.ts +6 -6
- package/commands/push.command.js +37 -37
- package/commands/schema.command.d.ts +3 -3
- package/commands/schema.command.js +18 -18
- package/exec.d.ts +2 -2
- package/exec.js +145 -146
- package/exec.js.map +1 -1
- package/index.d.ts +3 -3
- package/index.js +19 -19
- package/interfaces/index.d.ts +1 -1
- package/interfaces/index.js +17 -17
- package/interfaces/loader.interface.d.ts +20 -20
- package/interfaces/loader.interface.js +2 -2
- package/main.d.ts +2 -2
- package/main.js +5 -5
- package/package.json +15 -15
- package/providers/app-settings.provider.d.ts +7 -7
- package/providers/app-settings.provider.d.ts.map +1 -1
- package/providers/app-settings.provider.js +51 -47
- package/providers/app-settings.provider.js.map +1 -1
- package/providers/azure-key-vault.provider.d.ts +19 -19
- package/providers/azure-key-vault.provider.js +148 -148
- package/providers/index.d.ts +6 -6
- package/providers/index.js +29 -29
- package/providers/local.provider.d.ts +7 -7
- package/providers/local.provider.js +41 -41
- package/providers/package-json.provider.d.ts +7 -7
- package/providers/package-json.provider.js +29 -29
- package/tsconfig.build.tsbuildinfo +1 -1
- package/utils/command.util.d.ts +12 -12
- package/utils/command.util.js +134 -135
- package/utils/command.util.js.map +1 -1
- package/utils/index.d.ts +6 -6
- package/utils/index.js +22 -22
- package/utils/interpolate.util.d.ts +3 -3
- package/utils/interpolate.util.js +32 -32
- package/utils/json.util.d.ts +4 -4
- package/utils/json.util.js +47 -47
- package/utils/logger.d.ts +2 -2
- package/utils/logger.js +17 -17
- package/utils/normalize.util.d.ts +2 -2
- package/utils/normalize.util.js +60 -60
- package/utils/schema.util.d.ts +10 -10
- package/utils/schema.util.js +99 -99
|
@@ -1,149 +1,149 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.AzureKeyVaultProvider = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const azure_key_vault_1 = require("@achs/azure-key-vault");
|
|
9
|
-
const utils_1 = require("../utils");
|
|
10
|
-
const fs_1 = require("fs");
|
|
11
|
-
const KEY = 'azure-key-vault';
|
|
12
|
-
const logger = utils_1.logger.getChildLogger({
|
|
13
|
-
prefix: [chalk_1.default.bold.blue(`[${KEY}]`)]
|
|
14
|
-
});
|
|
15
|
-
exports.AzureKeyVaultProvider = {
|
|
16
|
-
key: KEY,
|
|
17
|
-
builder: (builder) => {
|
|
18
|
-
builder.options({
|
|
19
|
-
secretsFile: {
|
|
20
|
-
group: KEY,
|
|
21
|
-
type: 'string',
|
|
22
|
-
default: '[[root]]/[[env]].env.json',
|
|
23
|
-
describe: 'Secret variables file path'
|
|
24
|
-
},
|
|
25
|
-
keysFile: {
|
|
26
|
-
group: KEY,
|
|
27
|
-
alias: ['k', 'keys'],
|
|
28
|
-
type: 'array',
|
|
29
|
-
default: ['[[root]]/keys.json', '../keys.json'],
|
|
30
|
-
describe: 'Azure Key Vault keys file path'
|
|
31
|
-
},
|
|
32
|
-
vaultUrl: {
|
|
33
|
-
group: KEY,
|
|
34
|
-
alias: 'url',
|
|
35
|
-
type: 'string',
|
|
36
|
-
describe: 'Azure Key Vault URL'
|
|
37
|
-
},
|
|
38
|
-
spn: {
|
|
39
|
-
group: KEY,
|
|
40
|
-
alias: ['clientId', 'id'],
|
|
41
|
-
type: 'string',
|
|
42
|
-
describe: 'SPN Client ID'
|
|
43
|
-
},
|
|
44
|
-
password: {
|
|
45
|
-
group: KEY,
|
|
46
|
-
alias: ['p', 'pass', 'clientSecret'],
|
|
47
|
-
type: 'string',
|
|
48
|
-
describe: 'SPN Client Secret Password'
|
|
49
|
-
},
|
|
50
|
-
tenant: {
|
|
51
|
-
group: KEY,
|
|
52
|
-
alias: 't',
|
|
53
|
-
type: 'string',
|
|
54
|
-
describe: 'Azure Tenant ID'
|
|
55
|
-
},
|
|
56
|
-
mock: {
|
|
57
|
-
group: KEY,
|
|
58
|
-
type: 'boolean',
|
|
59
|
-
default: false,
|
|
60
|
-
describe: 'Mocks Azure Key Vault client'
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
},
|
|
64
|
-
push: async (argv, config) => {
|
|
65
|
-
var _a;
|
|
66
|
-
const [secrets, secretsWasFound] = await (0, utils_1.readJson)(argv.secretsFile);
|
|
67
|
-
if (!secretsWasFound) {
|
|
68
|
-
logger.error(`${chalk_1.default.blue(argv.secretFile)} not found`);
|
|
69
|
-
process.exit(1);
|
|
70
|
-
}
|
|
71
|
-
logger.silly('local secrets loaded:', secrets);
|
|
72
|
-
const akv = await loadAzureKeyVaultClient(argv, (_a = config === null || config === void 0 ? void 0 : config[argv.env]) === null || _a === void 0 ? void 0 : _a.vaultUrl);
|
|
73
|
-
logger.info('pushing variables to store');
|
|
74
|
-
const results = await akv.setAll(secrets);
|
|
75
|
-
logger.silly('secrets pushed:', results);
|
|
76
|
-
const schema = await (0, utils_1.generateSchemaFrom)([{ key: KEY, value: secrets }], argv);
|
|
77
|
-
logger.silly('schema for akv updated:', schema);
|
|
78
|
-
},
|
|
79
|
-
pull: async (argv, config) => {
|
|
80
|
-
var _a, _b;
|
|
81
|
-
const schema = (_a = argv.schema) === null || _a === void 0 ? void 0 : _a[KEY];
|
|
82
|
-
if (!schema) {
|
|
83
|
-
logger.error('no schema found');
|
|
84
|
-
logger.info(`generating empty ${chalk_1.default.bold.underline.yellowBright(argv.secretsFile)} file (you can retry command)`);
|
|
85
|
-
await (0, utils_1.writeJson)(argv.secretsFile, {}, false, true);
|
|
86
|
-
process.exit(1);
|
|
87
|
-
}
|
|
88
|
-
const jsonTemplate = (0, utils_1.schemaToJson)(schema);
|
|
89
|
-
const akv = await loadAzureKeyVaultClient(argv, (_b = config === null || config === void 0 ? void 0 : config[argv.env]) === null || _b === void 0 ? void 0 : _b.vaultUrl);
|
|
90
|
-
logger.info('pulling variables from store');
|
|
91
|
-
const secrets = await akv.getFor(jsonTemplate, true);
|
|
92
|
-
logger.silly('remote secrets loaded:', secrets);
|
|
93
|
-
await (0, utils_1.writeJson)(argv.secretsFile, secrets, argv.overwrite, true);
|
|
94
|
-
},
|
|
95
|
-
load: async (argv, config) => {
|
|
96
|
-
const { secretsFile, env } = argv;
|
|
97
|
-
if (!env) {
|
|
98
|
-
logger.silly('no env, so skipping provider');
|
|
99
|
-
return [];
|
|
100
|
-
}
|
|
101
|
-
if (!(0, fs_1.existsSync)(secretsFile)) {
|
|
102
|
-
logger.warn('secrets file not found, pulling from store');
|
|
103
|
-
await exports.AzureKeyVaultProvider.pull(argv, config);
|
|
104
|
-
}
|
|
105
|
-
const [secrets] = await (0, utils_1.readJson)(secretsFile);
|
|
106
|
-
return [secrets];
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
function keysAreValid(keys) {
|
|
110
|
-
return keys && keys.clientId && keys.clientSecret && keys.tenantId;
|
|
111
|
-
}
|
|
112
|
-
async function loadKeysFile(env, paths) {
|
|
113
|
-
var _a, _b;
|
|
114
|
-
logger.debug(`searching keys at ${chalk_1.default.yellow(paths.join(','))}`);
|
|
115
|
-
const readers = await Promise.all(paths.map((path) => (0, utils_1.readJson)(path)));
|
|
116
|
-
const [keys, wasFound] = (_a = readers.find(([keys, wasFound]) => wasFound && keysAreValid(keys[env]))) !== null && _a !== void 0 ? _a : [null, false];
|
|
117
|
-
return (_b = keys === null || keys === void 0 ? void 0 : keys[env]) !== null && _b !== void 0 ? _b : {};
|
|
118
|
-
}
|
|
119
|
-
async function loadAzureKeyVaultClient({ env, vaultUrl, spn, password, tenant, projectInfo, keysFile, mock }, configVaultUrl) {
|
|
120
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
121
|
-
let url = (_b = (_a = process.env.AZURE_VAULT_URL) !== null && _a !== void 0 ? _a : vaultUrl) !== null && _b !== void 0 ? _b : configVaultUrl;
|
|
122
|
-
const config = {
|
|
123
|
-
project: (_c = process.env.AZURE_PROJECT) !== null && _c !== void 0 ? _c : projectInfo.project,
|
|
124
|
-
group: (_d = process.env.AZURE_GROUP) !== null && _d !== void 0 ? _d : projectInfo.name,
|
|
125
|
-
env
|
|
126
|
-
};
|
|
127
|
-
if (!config.project) {
|
|
128
|
-
logger.error(`no project info from ${chalk_1.default.blue('package.json')} found`);
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}
|
|
131
|
-
const credentials = {
|
|
132
|
-
clientId: (_e = process.env.AZURE_CLIENT_ID) !== null && _e !== void 0 ? _e : spn,
|
|
133
|
-
clientSecret: (_f = process.env.AZURE_CLIENT_SECRET) !== null && _f !== void 0 ? _f : password,
|
|
134
|
-
tenantId: (_g = process.env.AZURE_TENANT_ID) !== null && _g !== void 0 ? _g : tenant
|
|
135
|
-
};
|
|
136
|
-
if (keysFile && keysFile.length > 0 && !keysAreValid(credentials)) {
|
|
137
|
-
const keys = await loadKeysFile(env, keysFile);
|
|
138
|
-
url !== null && url !== void 0 ? url : (url = keys.vaultUrl);
|
|
139
|
-
(_h = credentials.clientId) !== null && _h !== void 0 ? _h : (credentials.clientId = keys.clientId);
|
|
140
|
-
(_j = credentials.clientSecret) !== null && _j !== void 0 ? _j : (credentials.clientSecret = keys.clientSecret);
|
|
141
|
-
(_k = credentials.tenantId) !== null && _k !== void 0 ? _k : (credentials.tenantId = keys.tenantId);
|
|
142
|
-
}
|
|
143
|
-
logger.debug(`credentials loaded for project ${chalk_1.default.bold.underline.yellowBright(config.project)} and group ${chalk_1.default.bold.underline.yellowBright(config.group)}`);
|
|
144
|
-
logger.debug(`connected to ${chalk_1.default.bold.underline.greenBright(url)}`);
|
|
145
|
-
return mock
|
|
146
|
-
? (0, azure_key_vault_1.createAzureKeyVaultMock)(config)
|
|
147
|
-
: new azure_key_vault_1.AzureKeyVault(url, config, credentials);
|
|
148
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AzureKeyVaultProvider = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const azure_key_vault_1 = require("@achs/azure-key-vault");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const fs_1 = require("fs");
|
|
11
|
+
const KEY = 'azure-key-vault';
|
|
12
|
+
const logger = utils_1.logger.getChildLogger({
|
|
13
|
+
prefix: [chalk_1.default.bold.blue(`[${KEY}]`)]
|
|
14
|
+
});
|
|
15
|
+
exports.AzureKeyVaultProvider = {
|
|
16
|
+
key: KEY,
|
|
17
|
+
builder: (builder) => {
|
|
18
|
+
builder.options({
|
|
19
|
+
secretsFile: {
|
|
20
|
+
group: KEY,
|
|
21
|
+
type: 'string',
|
|
22
|
+
default: '[[root]]/[[env]].env.json',
|
|
23
|
+
describe: 'Secret variables file path'
|
|
24
|
+
},
|
|
25
|
+
keysFile: {
|
|
26
|
+
group: KEY,
|
|
27
|
+
alias: ['k', 'keys'],
|
|
28
|
+
type: 'array',
|
|
29
|
+
default: ['[[root]]/keys.json', '../keys.json'],
|
|
30
|
+
describe: 'Azure Key Vault keys file path'
|
|
31
|
+
},
|
|
32
|
+
vaultUrl: {
|
|
33
|
+
group: KEY,
|
|
34
|
+
alias: 'url',
|
|
35
|
+
type: 'string',
|
|
36
|
+
describe: 'Azure Key Vault URL'
|
|
37
|
+
},
|
|
38
|
+
spn: {
|
|
39
|
+
group: KEY,
|
|
40
|
+
alias: ['clientId', 'id'],
|
|
41
|
+
type: 'string',
|
|
42
|
+
describe: 'SPN Client ID'
|
|
43
|
+
},
|
|
44
|
+
password: {
|
|
45
|
+
group: KEY,
|
|
46
|
+
alias: ['p', 'pass', 'clientSecret'],
|
|
47
|
+
type: 'string',
|
|
48
|
+
describe: 'SPN Client Secret Password'
|
|
49
|
+
},
|
|
50
|
+
tenant: {
|
|
51
|
+
group: KEY,
|
|
52
|
+
alias: 't',
|
|
53
|
+
type: 'string',
|
|
54
|
+
describe: 'Azure Tenant ID'
|
|
55
|
+
},
|
|
56
|
+
mock: {
|
|
57
|
+
group: KEY,
|
|
58
|
+
type: 'boolean',
|
|
59
|
+
default: false,
|
|
60
|
+
describe: 'Mocks Azure Key Vault client'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
push: async (argv, config) => {
|
|
65
|
+
var _a;
|
|
66
|
+
const [secrets, secretsWasFound] = await (0, utils_1.readJson)(argv.secretsFile);
|
|
67
|
+
if (!secretsWasFound) {
|
|
68
|
+
logger.error(`${chalk_1.default.blue(argv.secretFile)} not found`);
|
|
69
|
+
process.exit(1);
|
|
70
|
+
}
|
|
71
|
+
logger.silly('local secrets loaded:', secrets);
|
|
72
|
+
const akv = await loadAzureKeyVaultClient(argv, (_a = config === null || config === void 0 ? void 0 : config[argv.env]) === null || _a === void 0 ? void 0 : _a.vaultUrl);
|
|
73
|
+
logger.info('pushing variables to store');
|
|
74
|
+
const results = await akv.setAll(secrets);
|
|
75
|
+
logger.silly('secrets pushed:', results);
|
|
76
|
+
const schema = await (0, utils_1.generateSchemaFrom)([{ key: KEY, value: secrets }], argv);
|
|
77
|
+
logger.silly('schema for akv updated:', schema);
|
|
78
|
+
},
|
|
79
|
+
pull: async (argv, config) => {
|
|
80
|
+
var _a, _b;
|
|
81
|
+
const schema = (_a = argv.schema) === null || _a === void 0 ? void 0 : _a[KEY];
|
|
82
|
+
if (!schema) {
|
|
83
|
+
logger.error('no schema found');
|
|
84
|
+
logger.info(`generating empty ${chalk_1.default.bold.underline.yellowBright(argv.secretsFile)} file (you can retry command)`);
|
|
85
|
+
await (0, utils_1.writeJson)(argv.secretsFile, {}, false, true);
|
|
86
|
+
process.exit(1);
|
|
87
|
+
}
|
|
88
|
+
const jsonTemplate = (0, utils_1.schemaToJson)(schema);
|
|
89
|
+
const akv = await loadAzureKeyVaultClient(argv, (_b = config === null || config === void 0 ? void 0 : config[argv.env]) === null || _b === void 0 ? void 0 : _b.vaultUrl);
|
|
90
|
+
logger.info('pulling variables from store');
|
|
91
|
+
const secrets = await akv.getFor(jsonTemplate, true);
|
|
92
|
+
logger.silly('remote secrets loaded:', secrets);
|
|
93
|
+
await (0, utils_1.writeJson)(argv.secretsFile, secrets, argv.overwrite, true);
|
|
94
|
+
},
|
|
95
|
+
load: async (argv, config) => {
|
|
96
|
+
const { secretsFile, env } = argv;
|
|
97
|
+
if (!env) {
|
|
98
|
+
logger.silly('no env, so skipping provider');
|
|
99
|
+
return [];
|
|
100
|
+
}
|
|
101
|
+
if (!(0, fs_1.existsSync)(secretsFile)) {
|
|
102
|
+
logger.warn('secrets file not found, pulling from store');
|
|
103
|
+
await exports.AzureKeyVaultProvider.pull(argv, config);
|
|
104
|
+
}
|
|
105
|
+
const [secrets] = await (0, utils_1.readJson)(secretsFile);
|
|
106
|
+
return [secrets];
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
function keysAreValid(keys) {
|
|
110
|
+
return keys && keys.clientId && keys.clientSecret && keys.tenantId;
|
|
111
|
+
}
|
|
112
|
+
async function loadKeysFile(env, paths) {
|
|
113
|
+
var _a, _b;
|
|
114
|
+
logger.debug(`searching keys at ${chalk_1.default.yellow(paths.join(','))}`);
|
|
115
|
+
const readers = await Promise.all(paths.map((path) => (0, utils_1.readJson)(path)));
|
|
116
|
+
const [keys, wasFound] = (_a = readers.find(([keys, wasFound]) => wasFound && keysAreValid(keys[env]))) !== null && _a !== void 0 ? _a : [null, false];
|
|
117
|
+
return (_b = keys === null || keys === void 0 ? void 0 : keys[env]) !== null && _b !== void 0 ? _b : {};
|
|
118
|
+
}
|
|
119
|
+
async function loadAzureKeyVaultClient({ env, vaultUrl, spn, password, tenant, projectInfo, keysFile, mock }, configVaultUrl) {
|
|
120
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
121
|
+
let url = (_b = (_a = process.env.AZURE_VAULT_URL) !== null && _a !== void 0 ? _a : vaultUrl) !== null && _b !== void 0 ? _b : configVaultUrl;
|
|
122
|
+
const config = {
|
|
123
|
+
project: (_c = process.env.AZURE_PROJECT) !== null && _c !== void 0 ? _c : projectInfo.project,
|
|
124
|
+
group: (_d = process.env.AZURE_GROUP) !== null && _d !== void 0 ? _d : projectInfo.name,
|
|
125
|
+
env
|
|
126
|
+
};
|
|
127
|
+
if (!config.project) {
|
|
128
|
+
logger.error(`no project info from ${chalk_1.default.blue('package.json')} found`);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
const credentials = {
|
|
132
|
+
clientId: (_e = process.env.AZURE_CLIENT_ID) !== null && _e !== void 0 ? _e : spn,
|
|
133
|
+
clientSecret: (_f = process.env.AZURE_CLIENT_SECRET) !== null && _f !== void 0 ? _f : password,
|
|
134
|
+
tenantId: (_g = process.env.AZURE_TENANT_ID) !== null && _g !== void 0 ? _g : tenant
|
|
135
|
+
};
|
|
136
|
+
if (keysFile && keysFile.length > 0 && !keysAreValid(credentials)) {
|
|
137
|
+
const keys = await loadKeysFile(env, keysFile);
|
|
138
|
+
url !== null && url !== void 0 ? url : (url = keys.vaultUrl);
|
|
139
|
+
(_h = credentials.clientId) !== null && _h !== void 0 ? _h : (credentials.clientId = keys.clientId);
|
|
140
|
+
(_j = credentials.clientSecret) !== null && _j !== void 0 ? _j : (credentials.clientSecret = keys.clientSecret);
|
|
141
|
+
(_k = credentials.tenantId) !== null && _k !== void 0 ? _k : (credentials.tenantId = keys.tenantId);
|
|
142
|
+
}
|
|
143
|
+
logger.debug(`credentials loaded for project ${chalk_1.default.bold.underline.yellowBright(config.project)} and group ${chalk_1.default.bold.underline.yellowBright(config.group)}`);
|
|
144
|
+
logger.debug(`connected to ${chalk_1.default.bold.underline.greenBright(url)}`);
|
|
145
|
+
return mock
|
|
146
|
+
? (0, azure_key_vault_1.createAzureKeyVaultMock)(config)
|
|
147
|
+
: new azure_key_vault_1.AzureKeyVault(url, config, credentials);
|
|
148
|
+
}
|
|
149
149
|
//# sourceMappingURL=azure-key-vault.provider.js.map
|
package/providers/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EnvProvider } from '../interfaces';
|
|
2
|
-
declare const IntegratedProviders: Record<string, EnvProvider<any, any>>;
|
|
3
|
-
declare const IntegratedProviderConfig: {
|
|
4
|
-
path: string;
|
|
5
|
-
}[];
|
|
6
|
-
export { IntegratedProviders, IntegratedProviderConfig };
|
|
1
|
+
import { EnvProvider } from '../interfaces';
|
|
2
|
+
declare const IntegratedProviders: Record<string, EnvProvider<any, any>>;
|
|
3
|
+
declare const IntegratedProviderConfig: {
|
|
4
|
+
path: string;
|
|
5
|
+
}[];
|
|
6
|
+
export { IntegratedProviders, IntegratedProviderConfig };
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/providers/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.IntegratedProviderConfig = exports.IntegratedProviders = void 0;
|
|
4
|
-
const app_settings_provider_1 = require("./app-settings.provider");
|
|
5
|
-
const package_json_provider_1 = require("./package-json.provider");
|
|
6
|
-
const azure_key_vault_provider_1 = require("./azure-key-vault.provider");
|
|
7
|
-
const local_provider_1 = require("./local.provider");
|
|
8
|
-
const IntegratedProviders = {
|
|
9
|
-
[package_json_provider_1.PackageJsonProvider.key]: package_json_provider_1.PackageJsonProvider,
|
|
10
|
-
[app_settings_provider_1.AppSettingsProvider.key]: app_settings_provider_1.AppSettingsProvider,
|
|
11
|
-
[azure_key_vault_provider_1.AzureKeyVaultProvider.key]: azure_key_vault_provider_1.AzureKeyVaultProvider,
|
|
12
|
-
[local_provider_1.LocalProvider.key]: local_provider_1.LocalProvider
|
|
13
|
-
};
|
|
14
|
-
exports.IntegratedProviders = IntegratedProviders;
|
|
15
|
-
const IntegratedProviderConfig = [
|
|
16
|
-
{
|
|
17
|
-
path: package_json_provider_1.PackageJsonProvider.key
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
path: app_settings_provider_1.AppSettingsProvider.key
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
path: azure_key_vault_provider_1.AzureKeyVaultProvider.key
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
path: local_provider_1.LocalProvider.key
|
|
27
|
-
}
|
|
28
|
-
];
|
|
29
|
-
exports.IntegratedProviderConfig = IntegratedProviderConfig;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IntegratedProviderConfig = exports.IntegratedProviders = void 0;
|
|
4
|
+
const app_settings_provider_1 = require("./app-settings.provider");
|
|
5
|
+
const package_json_provider_1 = require("./package-json.provider");
|
|
6
|
+
const azure_key_vault_provider_1 = require("./azure-key-vault.provider");
|
|
7
|
+
const local_provider_1 = require("./local.provider");
|
|
8
|
+
const IntegratedProviders = {
|
|
9
|
+
[package_json_provider_1.PackageJsonProvider.key]: package_json_provider_1.PackageJsonProvider,
|
|
10
|
+
[app_settings_provider_1.AppSettingsProvider.key]: app_settings_provider_1.AppSettingsProvider,
|
|
11
|
+
[azure_key_vault_provider_1.AzureKeyVaultProvider.key]: azure_key_vault_provider_1.AzureKeyVaultProvider,
|
|
12
|
+
[local_provider_1.LocalProvider.key]: local_provider_1.LocalProvider
|
|
13
|
+
};
|
|
14
|
+
exports.IntegratedProviders = IntegratedProviders;
|
|
15
|
+
const IntegratedProviderConfig = [
|
|
16
|
+
{
|
|
17
|
+
path: package_json_provider_1.PackageJsonProvider.key
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
path: app_settings_provider_1.AppSettingsProvider.key
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
path: azure_key_vault_provider_1.AzureKeyVaultProvider.key
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
path: local_provider_1.LocalProvider.key
|
|
27
|
+
}
|
|
28
|
+
];
|
|
29
|
+
exports.IntegratedProviderConfig = IntegratedProviderConfig;
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CommandArguments } from '../arguments';
|
|
2
|
-
import { EnvProvider } from '../interfaces';
|
|
3
|
-
interface LocalCommandArguments extends CommandArguments {
|
|
4
|
-
localFile: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const LocalProvider: EnvProvider<LocalCommandArguments>;
|
|
7
|
-
export {};
|
|
1
|
+
import { CommandArguments } from '../arguments';
|
|
2
|
+
import { EnvProvider } from '../interfaces';
|
|
3
|
+
interface LocalCommandArguments extends CommandArguments {
|
|
4
|
+
localFile: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const LocalProvider: EnvProvider<LocalCommandArguments>;
|
|
7
|
+
export {};
|
|
8
8
|
//# sourceMappingURL=local.provider.d.ts.map
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.LocalProvider = void 0;
|
|
7
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
const utils_1 = require("../utils");
|
|
10
|
-
const KEY = 'local';
|
|
11
|
-
const logger = utils_1.logger.getChildLogger({
|
|
12
|
-
prefix: [chalk_1.default.bold.blue(`[${KEY}]`)]
|
|
13
|
-
});
|
|
14
|
-
exports.LocalProvider = {
|
|
15
|
-
key: KEY,
|
|
16
|
-
builder: (builder) => {
|
|
17
|
-
builder.options({
|
|
18
|
-
localFile: {
|
|
19
|
-
group: KEY,
|
|
20
|
-
alias: 'lf',
|
|
21
|
-
type: 'string',
|
|
22
|
-
default: '[[root]]/[[env]].local.env.json',
|
|
23
|
-
describe: 'Local secret variables file path'
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
load: async ({ localFile, ci, env }) => {
|
|
28
|
-
if (ci)
|
|
29
|
-
return [];
|
|
30
|
-
if (!env) {
|
|
31
|
-
logger.silly('no env, so skipping provider');
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
if (!(0, fs_1.existsSync)(localFile)) {
|
|
35
|
-
await (0, utils_1.writeJson)(localFile, {});
|
|
36
|
-
return [];
|
|
37
|
-
}
|
|
38
|
-
const [vars] = await (0, utils_1.readJson)(localFile);
|
|
39
|
-
return [vars];
|
|
40
|
-
}
|
|
41
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LocalProvider = void 0;
|
|
7
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const KEY = 'local';
|
|
11
|
+
const logger = utils_1.logger.getChildLogger({
|
|
12
|
+
prefix: [chalk_1.default.bold.blue(`[${KEY}]`)]
|
|
13
|
+
});
|
|
14
|
+
exports.LocalProvider = {
|
|
15
|
+
key: KEY,
|
|
16
|
+
builder: (builder) => {
|
|
17
|
+
builder.options({
|
|
18
|
+
localFile: {
|
|
19
|
+
group: KEY,
|
|
20
|
+
alias: 'lf',
|
|
21
|
+
type: 'string',
|
|
22
|
+
default: '[[root]]/[[env]].local.env.json',
|
|
23
|
+
describe: 'Local secret variables file path'
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
load: async ({ localFile, ci, env }) => {
|
|
28
|
+
if (ci)
|
|
29
|
+
return [];
|
|
30
|
+
if (!env) {
|
|
31
|
+
logger.silly('no env, so skipping provider');
|
|
32
|
+
return [];
|
|
33
|
+
}
|
|
34
|
+
if (!(0, fs_1.existsSync)(localFile)) {
|
|
35
|
+
await (0, utils_1.writeJson)(localFile, {});
|
|
36
|
+
return [];
|
|
37
|
+
}
|
|
38
|
+
const [vars] = await (0, utils_1.readJson)(localFile);
|
|
39
|
+
return [vars];
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
42
|
//# sourceMappingURL=local.provider.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CommandArguments } from '../arguments';
|
|
2
|
-
import { EnvProvider } from '../interfaces';
|
|
3
|
-
interface PackageJsonCommandArguments extends CommandArguments {
|
|
4
|
-
packageInfoPrefix: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const PackageJsonProvider: EnvProvider<PackageJsonCommandArguments>;
|
|
7
|
-
export {};
|
|
1
|
+
import { CommandArguments } from '../arguments';
|
|
2
|
+
import { EnvProvider } from '../interfaces';
|
|
3
|
+
interface PackageJsonCommandArguments extends CommandArguments {
|
|
4
|
+
packageInfoPrefix: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const PackageJsonProvider: EnvProvider<PackageJsonCommandArguments>;
|
|
7
|
+
export {};
|
|
8
8
|
//# sourceMappingURL=package-json.provider.d.ts.map
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PackageJsonProvider = void 0;
|
|
4
|
-
const KEY = 'package-json';
|
|
5
|
-
exports.PackageJsonProvider = {
|
|
6
|
-
key: KEY,
|
|
7
|
-
builder: (builder) => {
|
|
8
|
-
builder.options({
|
|
9
|
-
packageInfoPrefix: {
|
|
10
|
-
group: KEY,
|
|
11
|
-
alias: 'vp',
|
|
12
|
-
type: 'string',
|
|
13
|
-
default: '',
|
|
14
|
-
describe: 'Prefix for loaded variables using package-json provider'
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
},
|
|
18
|
-
load: ({ env = 'development', projectInfo, packageInfoPrefix }) => {
|
|
19
|
-
const { version, project, name, title, description } = projectInfo;
|
|
20
|
-
return {
|
|
21
|
-
[`${packageInfoPrefix}ENV`]: env !== null && env !== void 0 ? env : null,
|
|
22
|
-
[`${packageInfoPrefix}VERSION`]: version !== null && version !== void 0 ? version : null,
|
|
23
|
-
[`${packageInfoPrefix}PROJECT`]: project !== null && project !== void 0 ? project : null,
|
|
24
|
-
[`${packageInfoPrefix}NAME`]: name !== null && name !== void 0 ? name : null,
|
|
25
|
-
[`${packageInfoPrefix}TITLE`]: title !== null && title !== void 0 ? title : null,
|
|
26
|
-
[`${packageInfoPrefix}DESCRIPTION`]: description !== null && description !== void 0 ? description : null
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
};
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PackageJsonProvider = void 0;
|
|
4
|
+
const KEY = 'package-json';
|
|
5
|
+
exports.PackageJsonProvider = {
|
|
6
|
+
key: KEY,
|
|
7
|
+
builder: (builder) => {
|
|
8
|
+
builder.options({
|
|
9
|
+
packageInfoPrefix: {
|
|
10
|
+
group: KEY,
|
|
11
|
+
alias: 'vp',
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: '',
|
|
14
|
+
describe: 'Prefix for loaded variables using package-json provider'
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
},
|
|
18
|
+
load: ({ env = 'development', projectInfo, packageInfoPrefix }) => {
|
|
19
|
+
const { version, project, name, title, description } = projectInfo;
|
|
20
|
+
return {
|
|
21
|
+
[`${packageInfoPrefix}ENV`]: env !== null && env !== void 0 ? env : null,
|
|
22
|
+
[`${packageInfoPrefix}VERSION`]: version !== null && version !== void 0 ? version : null,
|
|
23
|
+
[`${packageInfoPrefix}PROJECT`]: project !== null && project !== void 0 ? project : null,
|
|
24
|
+
[`${packageInfoPrefix}NAME`]: name !== null && name !== void 0 ? name : null,
|
|
25
|
+
[`${packageInfoPrefix}TITLE`]: title !== null && title !== void 0 ? title : null,
|
|
26
|
+
[`${packageInfoPrefix}DESCRIPTION`]: description !== null && description !== void 0 ? description : null
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
30
|
//# sourceMappingURL=package-json.provider.js.map
|