Skip to content

Commit

Permalink
Merge pull request #30 from aodn/support_dot_env
Browse files Browse the repository at this point in the history
Support dot env
  • Loading branch information
digorgonzola authored Dec 19, 2023
2 parents 9b46d10 + 2806110 commit e8be96d
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 17 deletions.
10 changes: 10 additions & 0 deletions deploy/container/default.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ALLOWED_CIDR_NETS=0.0.0.0/0
ALLOWED_HOSTS=*
DB_HOST=
DB_NAME=
DB_SECRET_NAME=
DB_SECRET_REGION=
DB_USER=
DJANGO_SECRET_KEY=changeme
S3_STORAGE_BUCKET_NAME=
S3_STORAGE_BUCKET_REGION=
12 changes: 0 additions & 12 deletions deploy/container/env_vars.yaml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions deploy/tg/ecs/terragrunt.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ locals {
global = include.global.locals

# container/task environment variables
default_env_vars = yamldecode(file("../../container/env_vars.yaml"))
default_env_vars = { for tuple in regexall("(.*?)=(.*)", file("../../container/default.env")) : tuple[0] => tuple[1] }

# get any overrides from the environment (e.g. GitHub deployment variables)
override_env_vars = {
for k, v in local.default_env_vars :
k => can(get_env(upper(k))) ? get_env(upper(k)) : v
k => can(get_env(k)) ? get_env(k) : v
}

# remove null values from the override map
# remove empty values from the override map
env_vars = {
for k, v in local.override_env_vars : k => v if v != null && v != ""
for k, v in local.override_env_vars : k => v if v != ""
}

default_hostname = join("-", [get_env("APP_NAME"), local.global.environment])

iam_statements = try(yamldecode(templatefile("../..//iam_statements/${local.global.environment}.yaml",
iam_statements = try(yamldecode(templatefile("../..//iam_statements/${local.global.environment}.yaml.tftpl",
{
aws_account = local.global.aws_account
aws_region = local.global.aws_region
Expand Down

0 comments on commit e8be96d

Please sign in to comment.