@orion-js/env 3.1.23 → 3.2.0
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/README.md +2 -2
- package/lib/cli/add/index.d.ts +2 -2
- package/lib/cli/add/index.js +5 -5
- package/lib/cli/init/index.d.ts +2 -2
- package/lib/cli/init/index.js +4 -4
- package/lib/environment/getDts.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Orion Env
|
|
2
2
|
|
|
3
|
-
> This package works as standlaone package. It does not depend on any other orionjs package.
|
|
4
|
-
|
|
5
3
|
Orion Env is a utility for managing a collection of secrets in source control. The secrets are encrypted using public key, elliptic curve cryptography.
|
|
6
4
|
|
|
5
|
+
> This package works as standlaone package. It does not depend on any other orionjs package.
|
|
6
|
+
|
|
7
7
|
It's like dotEnv but saved in source control.
|
|
8
8
|
|
|
9
9
|
## Creating a new Env config file
|
package/lib/cli/add/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function envAdd({
|
|
2
|
-
|
|
1
|
+
export default function envAdd({ path }: {
|
|
2
|
+
path: any;
|
|
3
3
|
}): Promise<void>;
|
package/lib/cli/add/index.js
CHANGED
|
@@ -17,11 +17,11 @@ const sortObjectByKeys = (object) => {
|
|
|
17
17
|
});
|
|
18
18
|
return sorted;
|
|
19
19
|
};
|
|
20
|
-
async function envAdd({
|
|
21
|
-
if (!
|
|
22
|
-
|
|
20
|
+
async function envAdd({ path }) {
|
|
21
|
+
if (!path) {
|
|
22
|
+
path = '.env.local.yml';
|
|
23
23
|
}
|
|
24
|
-
const config = (0, getConfig_1.getConfig)(
|
|
24
|
+
const config = (0, getConfig_1.getConfig)(path);
|
|
25
25
|
const { key, value } = await (0, getParams_1.getParams)(config);
|
|
26
26
|
if (!value)
|
|
27
27
|
return;
|
|
@@ -30,6 +30,6 @@ async function envAdd({ envPath }) {
|
|
|
30
30
|
config.cleanKeys = sortObjectByKeys(config.cleanKeys);
|
|
31
31
|
config.encryptedKeys = sortObjectByKeys(config.encryptedKeys);
|
|
32
32
|
const text = yaml_1.default.stringify(config);
|
|
33
|
-
(0, files_1.writeFile)(
|
|
33
|
+
(0, files_1.writeFile)(path, text);
|
|
34
34
|
}
|
|
35
35
|
exports.default = envAdd;
|
package/lib/cli/init/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function envInit({
|
|
2
|
-
|
|
1
|
+
export default function envInit({ path }: {
|
|
2
|
+
path: any;
|
|
3
3
|
}): Promise<void>;
|
package/lib/cli/init/index.js
CHANGED
|
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
const yaml_1 = __importDefault(require("yaml"));
|
|
7
7
|
const crypto_1 = require("../../crypto");
|
|
8
8
|
const files_1 = require("../../files");
|
|
9
|
-
async function envInit({
|
|
10
|
-
if (!
|
|
11
|
-
|
|
9
|
+
async function envInit({ path }) {
|
|
10
|
+
if (!path) {
|
|
11
|
+
path = '.env.local.yml';
|
|
12
12
|
}
|
|
13
13
|
const keypair = (0, crypto_1.generateKeys)();
|
|
14
14
|
const envFile = {
|
|
@@ -18,7 +18,7 @@ async function envInit({ envPath }) {
|
|
|
18
18
|
encryptedKeys: {}
|
|
19
19
|
};
|
|
20
20
|
const text = yaml_1.default.stringify(envFile);
|
|
21
|
-
(0, files_1.writeFile)(
|
|
21
|
+
(0, files_1.writeFile)(path, text);
|
|
22
22
|
console.log('');
|
|
23
23
|
console.log(`Environment file created. You need to use the following key to decrypt the environment variables:`);
|
|
24
24
|
console.log('');
|
|
@@ -7,7 +7,7 @@ function getDts(config) {
|
|
|
7
7
|
const keys = [...Object.keys(config.cleanKeys), ...Object.keys(config.encryptedKeys)];
|
|
8
8
|
return `declare module '@orion-js/env' {
|
|
9
9
|
export const env: {
|
|
10
|
-
${keys.map(key => ` ${key}: string
|
|
10
|
+
${keys.map(key => ` ${key}: string`).join('\n')}
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/env",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "683cc5a018d45654ddf1299ea28e291fc7367dee"
|
|
35
35
|
}
|