Skip to content

Commit 4eca732

Browse files
committed
updates
1 parent 21dd9ce commit 4eca732

7 files changed

Lines changed: 149 additions & 92 deletions

File tree

_data/search.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ entries:
6666
boost: 50
6767
/docs/go/:
6868
boost: 50
69+
/docs/echo/:
70+
boost: 50
6971
/docs/ruby/:
7072
boost: 50
7173
/docs/rails/:

_layouts/docs-quickstart.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,7 @@ <h2 class="design-page-title design-page-title--flush">{{ page.run_title | defau
137137

138138
{% if content != blank %}
139139
{% capture step_content %}
140-
<div class="docs-quickstart-extra design-prose">
141-
{{ content }}
142-
</div>
140+
{{ content }}
143141
{% endcapture %}
144142
{% include components/design-step.html content=step_content %}
145143
{% endif %}

docs/cli/native.md

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,48 @@ options:
2222
- title: "native pull"
2323
href: /docs/cli/native/pull/
2424
---
25-
Native uses your operating system's secret store:
25+
Native uses your operating system's secret store.
2626

27-
- macOS: Keychain
28-
- Windows: Credential Manager
29-
- Linux: Secret Service through `secret-tool`
27+
{% capture native_macos %}
28+
$ dotenvx native # stored in your keychain
29+
{% endcapture %}
30+
{% capture native_windows %}
31+
$ dotenvx native # stored in Credential Manager
32+
{% endcapture %}
33+
{% capture native_linux %}
34+
$ dotenvx native # stored with secret-tool
35+
{% endcapture %}
36+
{% capture native_copy %}dotenvx native{% endcapture %}
37+
{% capture native_panels %}
38+
{% include components/design-choice-code-panel.html
39+
id="macos"
40+
active=true
41+
code=native_macos
42+
copy_text=native_copy
43+
%}
44+
{% include components/design-choice-code-panel.html
45+
id="windows"
46+
code=native_windows
47+
copy_text=native_copy
48+
%}
49+
{% include components/design-choice-code-panel.html
50+
id="linux"
51+
code=native_linux
52+
copy_text=native_copy
53+
%}
54+
{% endcapture %}
55+
{% capture native_options %}
56+
{% include components/design-choice-option.html label="macOS" value="macos" selected=true %}
57+
{% include components/design-choice-option.html label="Windows" value="windows" %}
58+
{% include components/design-choice-option.html label="Linux" value="linux" %}
59+
{% endcapture %}
60+
{% include components/design-choice-code.html
61+
count=3
62+
selected="macos"
63+
lines=1
64+
aria_label="Operating system"
65+
panels=native_panels
66+
options=native_options
67+
%}
3068

3169
On Linux, `secret-tool` and an available Secret Service are required.
32-
33-
{% capture cli_code_0 %}
34-
$ dotenvx native
35-
{% endcapture %}
36-
{% capture cli_code_0_copy %}dotenvx native{% endcapture %}
37-
{% include components/design-codeblock.html value=cli_code_0 copy_text=cli_code_0_copy %}

docs/echo.md

Lines changed: 53 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,61 @@
11
---
2-
title: Echo
3-
description: Use dotenvx with Echo.
2+
layout: docs-quickstart
3+
title: "Echo"
4+
social_title: "Encrypt a .env file in Echo"
5+
description: "Encrypt a .env file in Echo with dotenvx, commit it safely, and inject its secrets at runtime."
6+
icon: go
47
permalink: /docs/echo/
5-
layout: radar
68
redirect_from:
79
- /docs/frameworks/echo
810
- /docs/frameworks/echo/
9-
---
11+
- /docs/secrets-in-echo/
12+
- /docs/secrets-in-echo
13+
install_copy: "curl -sfS https://dotenvx.sh | sh"
14+
encrypt_copy: "dotenvx encrypt"
15+
install: |
16+
$ curl -sfS https://dotenvx.sh | sh
17+
encrypt: |
18+
$ dotenvx encrypt
19+
inject_lede: |
20+
Then inject your encrypted secrets at runtime with `dotenvx run`.
21+
inject_copy: |
22+
package main
23+
24+
import (
25+
"fmt"
26+
"net/http"
27+
"os"
28+
29+
"github.com/labstack/echo/v4"
30+
)
1031
11-
{% include components/docs-hero.html
12-
eyebrow="Docs"
13-
title="Echo"
14-
description="Use dotenvx with Echo."
15-
mark="echo"
16-
%}
32+
func main() {
33+
e := echo.New()
34+
e.GET("/", func(c echo.Context) error {
35+
return c.String(http.StatusOK, fmt.Sprintf("HELLO: %s", os.Getenv("HELLO")))
36+
})
37+
e.Logger.Fatal(e.Start(":1323"))
38+
}
39+
inject: |
40+
package main
1741
18-
{% capture echo_platforms_items %}
19-
<li>
20-
<a class="design-link" href="/docs/docker">Docker</a>
21-
<span class="design-list-meta">dotenvx, Echo, and Docker</span>
22-
</li>
23-
<li>
24-
<a class="design-link" href="/docs/platforms/heroku">Heroku</a>
25-
<span class="design-list-meta">dotenvx, Echo, and Heroku</span>
26-
</li>
27-
{% endcapture %}
42+
import (
43+
"fmt"
44+
"net/http"
45+
"os"
2846
29-
<section class="radar-section">
30-
<div class="armor-shell">
31-
{% include components/design-list.html
32-
title="Platforms"
33-
items=echo_platforms_items
34-
%}
35-
</div>
36-
</section>
47+
"github.com/labstack/echo/v4"
48+
)
49+
50+
func main() {
51+
e := echo.New()
52+
e.GET("/", func(c echo.Context) error {
53+
return c.String(http.StatusOK, fmt.Sprintf("HELLO: %s", os.Getenv("HELLO")))
54+
})
55+
e.Logger.Fatal(e.Start(":1323"))
56+
}
57+
inject_after_copy: |
58+
dotenvx run -- go run main.go
59+
inject_after: |
60+
$ dotenvx run -- go run main.go
61+
---

docs/nextjs.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ inject: |
5353
}
5454
---
5555

56-
<p class="design-list-title">Troubleshooting</p>
57-
<p class="design-paragraph">Not taking effect? NPM can be inconsistent with overrides. Delete <code class="design-code">package-lock.json</code>, <code class="design-code">node_modules</code>, and reinstall.</p>
58-
59-
{% capture nextjs_reinstall %}
56+
<div class="design-list">
57+
<p class="design-list-title">Troubleshooting</p>
58+
<p class="design-paragraph">Not taking effect? NPM can be inconsistent with overrides. Delete <code class="design-code">package-lock.json</code>, <code class="design-code">node_modules</code>, and reinstall.</p>
59+
{% capture nextjs_reinstall %}
6060
rm -rf node_modules package-lock.json
6161
npm install
62-
{% endcapture %}
63-
{% include components/design-codeblock.html value=nextjs_reinstall copy_text="rm -rf node_modules package-lock.json
62+
{% endcapture %}
63+
{% include components/design-codeblock.html value=nextjs_reinstall copy_text="rm -rf node_modules package-lock.json
6464
npm install" %}
65+
</div>

docs/quickstart/encryption.md

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -33,82 +33,81 @@ TWILIO_API_KEY=\"encrypted:a1b2c3d4\"" %}
3333
<div class="armor-shell">
3434
<section class="docs-quickstart-body">
3535
{% capture step_content %}
36-
<h2 class="design-page-title design-page-title--flush">Usage</h2>
37-
{% capture encrypt_setup %}
38-
$ touch .env
39-
$ echo "console.log('Hello ' + process.env.HELLO)" > index.js
40-
36+
<h2 class="design-page-title design-page-title--flush">1. Encrypt</h2>
37+
<p class="design-paragraph">Encrypt your <code class="design-code">.env</code> file.</p>
38+
{% capture encrypt_cmd %}
4139
$ dotenvx encrypt
4240
{% endcapture %}
43-
{% include components/design-codeblock.html value=encrypt_setup copy_text="dotenvx encrypt" %}
44-
45-
<p class="design-paragraph">Your <code class="design-code">.env</code> file will now look something like this.</p>
41+
{% include components/design-codeblock.html value=encrypt_cmd copy_text="dotenvx encrypt" %}
42+
{% endcapture %}
43+
{% include components/design-step.html content=step_content %}
4644

45+
{% capture step_content %}
46+
<h2 class="design-page-title design-page-title--flush">2. Encrypted .env</h2>
47+
<p class="design-paragraph">Your public encryption key <code class="design-code">DOTENV_PUBLIC_KEY</code> lands at the top of <code class="design-code">.env</code> so anyone on your team can encrypt secrets.</p>
4748
{% capture encrypt_env %}
48-
#/-------------------[DOTENV_PUBLIC_KEY]--------------------/
49-
#/ public-key encryption for .env files /
50-
#/ [how it works](https://dotenvx.com/encryption) /
51-
#/----------------------------------------------------------/
49+
# .env
5250
DOTENV_PUBLIC_KEY="037cfbfc90234cfdab7eb54050566293789efaa1a35dc420749662db400dc9c4b2"
5351

54-
# .env
5552
HELLO="encrypted:BAZb6wDPFaFeFzq8Ut48oiNFSPtYvJmv4AwVDFVcNKiIcGxrxuRIFGWxZ3xVjxOgOo6w65bWFTpAfbatSz52+VvwDYZ3nFUO828nzovH5ZhsIoxPuPb7K0ZphmNynR7Hxci4a+fB"
5653
{% endcapture %}
5754
{% include components/design-codeblock.html value=encrypt_env copy=false %}
58-
59-
<p class="design-paragraph">The public encryption key <code class="design-code">DOTENV_PUBLIC_KEY</code> is placed at the top of your <code class="design-code">.env</code> file. This allows anyone on your team to encrypt secrets.</p>
60-
61-
<p class="design-paragraph">The private decryption key <code class="design-code">DOTENV_PRIVATE_KEY</code> is placed in your <code class="design-code">.env.keys</code> file. Only those holding this key can decrypt secrets.</p>
62-
63-
<p class="design-paragraph">We recommend <a class="design-link" href="/docs/cli/lock/">locking</a>, <a class="design-link" href="/docs/cli/native/">keychaining</a>, or most seriously <a class="design-link" href="/docs/cli/armor/introduction/">armoring</a> your private key.</p>
6455
{% endcapture %}
6556
{% include components/design-step.html content=step_content %}
6657

6758
{% capture step_content %}
68-
<h2 class="design-page-title design-page-title--flush">DOTENV_PRIVATE_KEY</h2>
69-
<p class="design-paragraph">Locate your <code class="design-code">DOTENV_PRIVATE_KEY</code> in <code class="design-code">.env.keys</code>.</p>
70-
71-
{% capture encrypt_cat_keys %}
72-
$ cat .env.keys
73-
{% endcapture %}
74-
{% include components/design-codeblock.html value=encrypt_cat_keys copy_text="cat .env.keys" %}
75-
59+
<h2 class="design-page-title design-page-title--flush">3. Private key</h2>
60+
<p class="design-paragraph">Your private decryption key lives in <code class="design-code">.env.keys</code>. Do not commit it — only holders of this key can decrypt secrets.</p>
7661
{% capture encrypt_keys %}
77-
#/------------------!DOTENV_PRIVATE_KEYS!-------------------/
78-
#/ private decryption keys. DO NOT commit to source control /
79-
#/ [how it works](https://dotenvx.com/encryption) /
80-
#/----------------------------------------------------------/
81-
82-
# .env
62+
# .env.keys
8363
DOTENV_PRIVATE_KEY="81dac4d2c42e67a2c6542d3b943a4674a05c4be5e7e5a40a689be7a3bd49a07e"
8464
{% endcapture %}
8565
{% include components/design-codeblock.html value=encrypt_keys copy=false %}
8666
{% endcapture %}
8767
{% include components/design-step.html content=step_content %}
8868

8969
{% capture step_content %}
90-
<h2 class="design-page-title design-page-title--flush">Run</h2>
91-
<p class="design-paragraph">In development the <code class="design-code">dotenvx run</code> command reads from your <code class="design-code">.env.keys</code> file to decrypt and inject your secrets at runtime.</p>
92-
70+
<h2 class="design-page-title design-page-title--flush">4. Run locally</h2>
71+
<p class="design-paragraph">In development, <code class="design-code">dotenvx run</code> reads <code class="design-code">.env.keys</code> to decrypt and inject secrets at runtime.</p>
9372
{% capture encrypt_dev %}
9473
$ dotenvx run -- node index.js
9574
⟐ injected env (2) from .env
9675
Hello World
9776
{% endcapture %}
9877
{% include components/design-codeblock.html value=encrypt_dev copy_text="dotenvx run -- node index.js" %}
78+
{% endcapture %}
79+
{% include components/design-step.html content=step_content %}
9980

100-
<p class="design-paragraph">In production, do NOT include your <code class="design-code">.env.keys</code> file. Instead, set your <code class="design-code">DOTENV_PRIVATE_KEY</code> ahead of your <code class="design-code">dotenvx run</code> command and it will smartly run the associated <code class="design-code">.env</code> file — decrypting and injecting your secrets at runtime.</p>
101-
81+
{% capture step_content %}
82+
<h2 class="design-page-title design-page-title--flush">5. Run in production</h2>
83+
<p class="design-paragraph">Do not ship <code class="design-code">.env.keys</code>. Set <code class="design-code">DOTENV_PRIVATE_KEY</code> in the environment instead — dotenvx decrypts and injects at runtime.</p>
10284
{% capture encrypt_prod %}
103-
$ dotenvx set HELLO production -f .env.production
104-
$ DOTENV_PRIVATE_KEY_PRODUCTION="4a650a4159790e2341a388ebcd7526036fd33cc6240667c7cd940cde7b11cfaf" dotenvx run -- node index.js
105-
⟐ injected env (2) from .env.production
106-
Hello production
107-
> :-D
85+
$ DOTENV_PRIVATE_KEY="…" dotenvx run -- node index.js
10886
{% endcapture %}
10987
{% include components/design-codeblock.html value=encrypt_prod copy=false %}
88+
<p class="design-paragraph">No more scattering secrets across third-party platforms where they <a class="design-link" href="https://techcrunch.com/2023/01/05/circleci-breach/">could leak</a>.</p>
89+
{% endcapture %}
90+
{% include components/design-step.html content=step_content %}
11091

111-
<p class="design-paragraph">No more scattering your secrets across multiple third-parties platforms where they <a class="design-link" href="https://techcrunch.com/2023/01/05/circleci-breach/">could leak</a>!</p>
92+
{% capture step_content %}
93+
{% capture encrypt_related_items %}
94+
<li>
95+
<a class="design-link" href="/docs/cli/lock/">Lock</a>
96+
<span class="design-list-meta">password-protect your private key</span>
97+
</li>
98+
<li>
99+
<a class="design-link" href="/docs/cli/native/">Native</a>
100+
<span class="design-list-meta">store the key in your OS keychain</span>
101+
</li>
102+
<li>
103+
<a class="design-link" href="/docs/cli/armor/introduction/">Armor</a>
104+
<span class="design-list-meta">managed private keys</span>
105+
</li>
106+
{% endcapture %}
107+
{% include components/design-list.html
108+
title="Related"
109+
items=encrypt_related_items
110+
%}
112111
{% endcapture %}
113112
{% include components/design-step.html content=step_content %}
114113
</section>

docs/quickstarts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ layout: radar
164164
</li>
165165
<li>
166166
<a class="design-link" href="/docs/echo">Echo</a>
167-
<span class="design-list-meta">platforms</span>
167+
<span class="design-list-meta">dotenvx run -- go run</span>
168168
</li>
169169
{% endcapture %}
170170

0 commit comments

Comments
 (0)