Use set +a to load env variables, drop export #40

Closed
opened 2020-11-10 11:11:22 +00:00 by 3wordchant · 3 comments
Owner

Currently, our env files use dotenv / direnv format, where we export variables, e.g.

export APP=traefik

If we switched to .env format (the common 12-factor app pattern, i.e. without export), we could use the same file for both docker-compose, which loads .env from the current directory automatically, and abra, which can use set +a to automatically export variables from a loaded file:

set +a
source /path/to/env.env
set -a

Doing grep -lR 'export ' | sed -i 's/export //' across all the stacks should get us most of the way to the switch.

Currently, our env files use dotenv / direnv format, where we `export` variables, [e.g.](https://git.autonomic.zone/coop-cloud/traefik/src/branch/master/.envrc.sample#L1) `export APP=traefik` If we switched to `.env` format (the common 12-factor app pattern, i.e. without `export`), we could use the same file for both `docker-compose`, which loads `.env` from the current directory automatically, and `abra`, which can use `set +a` to automatically export variables from a loaded file: ``` set +a source /path/to/env.env set -a ``` Doing `grep -lR 'export ' | sed -i 's/export //'` across all the stacks should get us most of the way to the switch.
3wordchant added the
enhancement
label 2020-11-10 11:11:36 +00:00
decentral1se added the
breaking-change
label 2020-12-29 16:13:31 +00:00
Owner

When #55 is in some mergeable state and goes in, we'll need to update our app repos to use .env.sample and not .envrc.sample as well as removing all the export usages 🚒

When https://git.autonomic.zone/coop-cloud/abra/pulls/55 is in some mergeable state and goes in, we'll need to update our app repos to use `.env.sample` and not `.envrc.sample` as well as removing all the `export` usages 🚒
Owner

Something like adcb53b61c and 5d3fa1ad4f does the trick with the new abra changes.

Something like https://git.autonomic.zone/coop-cloud/gitea/commit/adcb53b61c52b4514be55ba8af72d8d5e01c641c and https://git.autonomic.zone/coop-cloud/gitea/commit/5d3fa1ad4f912b11d28253b852e1d3b4a524dddc does the trick with the new abra changes.
Author
Owner

Updated all our apps'n'stacks 👌

Updated all our apps'n'stacks 👌
This repo is archived. You cannot comment on issues.
No Milestone
No Assignees
2 Participants
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: coop-cloud/abra#40
No description provided.