@orion-js/env 3.9.0 → 3.11.5

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/lib/cli/index.js CHANGED
@@ -8,6 +8,7 @@ const commander_1 = require("commander");
8
8
  const safe_1 = __importDefault(require("colors/safe"));
9
9
  const init_1 = __importDefault(require("./init"));
10
10
  const add_1 = __importDefault(require("./add"));
11
+ const read_1 = __importDefault(require("./read"));
11
12
  const program = new commander_1.Command();
12
13
  const run = function (action) {
13
14
  return async function (...args) {
@@ -29,6 +30,13 @@ program
29
30
  .description('Adds a new environment to the encrypted env file')
30
31
  .option('--path <path>', 'Specify the env file name')
31
32
  .action(run(add_1.default));
33
+ program
34
+ .command('read')
35
+ .description('Prints the value of the env file in JSON or a specific variable in plain text')
36
+ .option('--path <path>', 'Specify the env file name')
37
+ .option('--key <key>', 'Prints the value of a specific variable in plain text')
38
+ .option('--secret <secret>', 'The password to decrypt the keys')
39
+ .action(run(read_1.default));
32
40
  program.parse(process.argv);
33
41
  if (!process.argv.slice(2).length) {
34
42
  program.outputHelp();
@@ -0,0 +1,5 @@
1
+ export default function envRead({ path, key, secret }: {
2
+ path: any;
3
+ key: any;
4
+ secret: any;
5
+ }): Promise<void>;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getVariables_1 = require("../../environment/getVariables");
4
+ const getConfig_1 = require("../add/getConfig");
5
+ async function envRead({ path, key, secret }) {
6
+ if (!path) {
7
+ path = '.env.local.yml';
8
+ }
9
+ if (!secret) {
10
+ throw new Error('Secret is required');
11
+ }
12
+ const config = (0, getConfig_1.getConfig)(path);
13
+ const variables = (0, getVariables_1.getVariables)(config, secret);
14
+ if (key) {
15
+ console.log(variables[key]);
16
+ }
17
+ else {
18
+ console.log(JSON.stringify(variables, null, 2));
19
+ }
20
+ }
21
+ exports.default = envRead;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orion-js/env",
3
- "version": "3.9.0",
3
+ "version": "3.11.5",
4
4
  "main": "lib/index.js",
5
5
  "author": "nicolaslopezj",
6
6
  "license": "MIT",
@@ -32,5 +32,5 @@
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "23e0eda5348153dcc07b307a97b641d52eb41f39"
35
+ "gitHead": "9021f320408e112fed1325638b74632a0ae54381"
36
36
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 Orionjs Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.