@dotenvx/dotenvx
Advanced tools
Comparing version 0.6.5 to 0.6.6
{ | ||
"version": "0.6.5", | ||
"version": "0.6.6", | ||
"name": "@dotenvx/dotenvx", | ||
@@ -4,0 +4,0 @@ "description": "a better dotenv–from the creator of `dotenv`", |
@@ -24,3 +24,4 @@ ![dotenvx](https://dotenvx.com/better-banner.png) | ||
```sh | ||
$ echo "HELLO=World" > .env && echo "console.log('Hello ' + process.env.HELLO)" > index.js | ||
$ echo "HELLO=World" > .env | ||
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js | ||
@@ -40,3 +41,4 @@ $ node index.js | ||
```sh | ||
$ echo "HELLO=World" > .env && echo 'import os;print("Hello " + os.getenv("HELLO", ""))' > index.py | ||
$ echo "HELLO=World" > .env | ||
$ echo 'import os;print("Hello " + os.getenv("HELLO", ""))' > index.py | ||
@@ -51,3 +53,4 @@ $ dotenvx run -- python3 index.py | ||
```sh | ||
$ echo "HELLO=World" > .env && echo '<?php echo "Hello {$_SERVER["HELLO"]}\n";' > index.php | ||
$ echo "HELLO=World" > .env | ||
$ echo '<?php echo "Hello {$_SERVER["HELLO"]}\n";' > index.php | ||
@@ -62,3 +65,4 @@ $ dotenvx run -- php index.php | ||
```sh | ||
$ echo "HELLO=World" > .env && echo 'puts "Hello #{ENV["HELLO"]}"' > index.rb | ||
$ echo "HELLO=World" > .env | ||
$ echo 'puts "Hello #{ENV["HELLO"]}"' > index.rb | ||
@@ -73,3 +77,4 @@ $ dotenvx run -- ruby index.rb | ||
```sh | ||
$ echo "HELLO=World" > .env && echo 'package main; import ("fmt"; "os"); func main() { fmt.Printf("Hello %s\n", os.Getenv("HELLO")) }' > main.go | ||
$ echo "HELLO=World" > .env | ||
$ echo 'package main; import ("fmt"; "os"); func main() { fmt.Printf("Hello %s\n", os.Getenv("HELLO")) }' > main.go | ||
@@ -84,3 +89,4 @@ $ dotenvx run -- go run main.go | ||
```sh | ||
$ echo "HELLO=World" > .env && echo 'fn main() {let hello = std::env::var("HELLO").unwrap_or("".to_string());println!("Hello {hello}");}' > src/main.rs | ||
$ echo "HELLO=World" > .env | ||
$ echo 'fn main() {let hello = std::env::var("HELLO").unwrap_or("".to_string());println!("Hello {hello}");}' > src/main.rs | ||
@@ -95,3 +101,4 @@ $ dotenvx run -- cargo run | ||
```sh | ||
$ echo "HELLO=World" > .env && echo 'public class Index { public static void main(String[] args) { System.out.println("Hello " + System.getenv("HELLO")); } }' > index.java | ||
$ echo "HELLO=World" > .env | ||
$ echo 'public class Index { public static void main(String[] args) { System.out.println("Hello " + System.getenv("HELLO")); } }' > index.java | ||
@@ -108,3 +115,4 @@ $ dotenvx run -- java index.java | ||
$ cd HelloWorld | ||
$ echo "HELLO=World" > .env && echo 'Console.WriteLine($"Hello {Environment.GetEnvironmentVariable("HELLO")}");' > Program.cs && echo "HELLO=World" > .env | ||
$ echo "HELLO=World" > .env | ||
$ echo 'Console.WriteLine($"Hello {Environment.GetEnvironmentVariable("HELLO")}");' > Program.cs | ||
@@ -287,18 +295,12 @@ $ dotenvx run -- dotnet run | ||
> Encrypt your secrets to a `.env.vault` file. | ||
``` | ||
$ echo "HELLO=World" > .env && echo "console.log('Hello ' + process.env.HELLO)" > index.js | ||
> Encrypt your secrets to a `.env.vault` file and load from it (recommended for production and ci). | ||
```sh | ||
$ echo "HELLO=World" > .env | ||
$ echo "HELLO=production" > .env.production | ||
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js | ||
$ dotenvx encrypt | ||
[dotenvx][info] encrypted to .env.vault (.env,.env.production) | ||
[dotenvx][info] key added to .env.keys (DOTENV_KEY_PRODUCTION) | ||
``` | ||
[dotenvx][info] keys added to .env.keys (DOTENV_KEY_PRODUCTION,DOTENV_KEY_PRODUCTION) | ||
| ||
> Then load env from encrypted `.env.vault` file | ||
```sh | ||
$ DOTENV_KEY='<dotenv_key_production>' dotenvx run -- node index.js | ||
@@ -305,0 +307,0 @@ [dotenvx][info] loading env (1) from encrypted .env.vault |
@@ -12,2 +12,3 @@ #!/usr/bin/env node | ||
const helpers = require('./helpers') | ||
const examples = require('./examples') | ||
const { AppendToIgnores } = require('./ignores') | ||
@@ -57,3 +58,4 @@ const packageJson = require('./../shared/packageJson') | ||
program.command('run') | ||
.description('load env into your application process') | ||
.description('inject env at runtime (example: `dotenvx run -- your-cmd`)') | ||
.addHelpText('after', examples.run) | ||
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)', '.env') | ||
@@ -174,2 +176,3 @@ .option('-o, --overload', 'override existing env variables') | ||
.description('encrypt .env.* to .env.vault') | ||
.addHelpText('after', examples.encrypt) | ||
.option('-f, --env-file <paths...>', 'path(s) to your env file(s)', helpers.findEnvFiles('./')) | ||
@@ -176,0 +179,0 @@ .action(function () { |
28052
9
553
415