Skip to content
This repository has been archived by the owner on Nov 12, 2024. It is now read-only.

doc: env-vars #509

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FASTN.ftd
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ skip: true
document: backend/ftd-redirect.ftd
- Using `fastn` With Django Or Other Backends: /django/
document: backend/django.ftd
- Enviroment Variables: /backend/env-vars/
siddhantk232 marked this conversation as resolved.
Show resolved Hide resolved

## Deploy: /github-pages/
document: author/how-to/github-pages.ftd
Expand Down
37 changes: 37 additions & 0 deletions backend/env-vars.ftd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
-- import: fastn-community.github.io/bling/note

-- ds.page: Environment Variables

Environment variables are automatically loaded from your `.env` file.

-- ds.h3: Automatic Environment Variables Loading with an `.env` File

By default, the fastn CLI is designed to automatically load environment
variables from an `.env` file located in the current working directory (CWD).

Here's an example file:

-- ds.code: .env
lang: sh

FASTN_CHECK_FOR_UPDATES=false
FASTN_PG_URL=postgres://user:[email protected]:5432/db_name
FASTN_GITHUB_CLIENT_ID=225b11ee49abca378769

-- ds.markdown:

Note that this automatic loading will not function if your
`.env` file is committed to a **Git repository**. In such cases, the CLI will
fail issuing a warning message.

To override this behavior and intentionally use an `.env` file checked into
Git, you can do so by setting the `FASTN_DANGER_ACCEPT_CHECKED_IN_ENV`
environment variable.

-- ds.code: Override (not recommended)
lang: sh

FASTN_DANGER_ACCEPT_CHECKED_IN_ENV=true fastn serve

-- end: ds.page