-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move heroku nodejs and digital ocean nodejs guide under extended lang…
…uage guides
- Loading branch information
Showing
15 changed files
with
271 additions
and
310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<div class="alert alert-secondary d-flex align-items-center" role="alert"> | ||
<div class="me-2"> | ||
{% include icons/github.html width="16" color="#181717" %} | ||
</div> | ||
<div> | ||
Find a complete <a href="{{ include.url }}">code example on GitHub</a> for this guide. | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<div class="alert alert-info"> | ||
<strong>Heads up!</strong> This guide assumes you are already familiar with <a href="https://github.com/motdotla/dotenv">dotenv</a> and have <a href="/docs/tutorials/sync">synced your secrets</a> with <a href="https://github.com/dotenv-org/dotenv-vault">dotenv-vault</a>. | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## Build .env.vault | ||
|
||
Push your latest `.env` file changes and edit your production secrets. [Learn more about syncing](/docs/tutorials/sync) | ||
|
||
##### CLI | ||
```shell | ||
npx dotenv-vault@latest push | ||
npx dotenv-vault@latest open production | ||
``` | ||
|
||
Use the UI to configure those secrets per environment. | ||
|
||
##### UI | ||
{% include helpers/screenshot_browser.html url="/assets/img/docs/edit-production-value.gif" www="dotenv.org" %} | ||
|
||
Then build your encrypted `.env.vault` file. | ||
|
||
##### CLI | ||
```shell | ||
npx dotenv-vault@latest build | ||
``` | ||
|
||
Its contents should look something like this. | ||
|
||
##### .env.vault | ||
```shell | ||
#/-------------------.env.vault---------------------/ | ||
#/ cloud-agnostic vaulting standard / | ||
#/ [how it works](https://dotenv.org/env-vault) / | ||
#/--------------------------------------------------/ | ||
|
||
# development | ||
DOTENV_VAULT_DEVELOPMENT="/HqNgQWsf6Oh6XB9pI/CGkdgCe6d4/vWZHgP50RRoDTzkzPQk/xOaQs=" | ||
DOTENV_VAULT_DEVELOPMENT_VERSION=2 | ||
|
||
# production | ||
DOTENV_VAULT_PRODUCTION="x26PuIKQ/xZ5eKrYomKngM+dO/9v1vxhwslE/zjHdg3l+H6q6PheB5GVDVIbZg==" | ||
DOTENV_VAULT_PRODUCTION_VERSION=2 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
## Install dotenv | ||
|
||
Install [`dotenv`](https://github.com/motdotla/dotenv). | ||
|
||
##### CLI | ||
```shell | ||
npm install dotenv --save # Requires dotenv >= 16.1.0 | ||
``` | ||
|
||
Create a `.env` file in the root of your project. | ||
|
||
##### .env | ||
```shell | ||
# .env | ||
HELLO="World" | ||
``` | ||
|
||
As early as possible in your application, import and configure dotenv. | ||
|
||
##### index.js | ||
```js | ||
// index.js | ||
require('dotenv').config() | ||
console.log(process.env) // remove this after you've confirmed it is working | ||
|
||
const PORT = process.env.PORT || 3000 | ||
const http = require('http') | ||
... | ||
``` | ||
|
||
Try running it locally. | ||
|
||
##### CLI | ||
```shell | ||
node index.js | ||
{ | ||
... | ||
HELLO: 'World' | ||
} | ||
Server running on port:3000/ | ||
``` | ||
|
||
Perfect. `process.env` now has the keys and values you defined in your `.env` file. | ||
|
||
That covers local development. Let's solve for production next. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.