diff options
Diffstat (limited to 'roles/contexts/fretlink')
-rw-r--r-- | roles/contexts/fretlink/templates/environment.j2 | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/roles/contexts/fretlink/templates/environment.j2 b/roles/contexts/fretlink/templates/environment.j2 index 91a6f6a..652fc8d 100644 --- a/roles/contexts/fretlink/templates/environment.j2 +++ b/roles/contexts/fretlink/templates/environment.j2 | |||
@@ -41,6 +41,10 @@ build_macaroon() { | |||
41 | popd 2>/dev/null >/dev/null | 41 | popd 2>/dev/null >/dev/null |
42 | } | 42 | } |
43 | 43 | ||
44 | function capitalize() { | ||
45 | echo "$1" | sed -e 's!\(^\|-\)\(.\)!\U\2!g' | ||
46 | } | ||
47 | |||
44 | APP=$(basename $(pwd)) | 48 | APP=$(basename $(pwd)) |
45 | 49 | ||
46 | FL_APPS_HOST="localhost" | 50 | FL_APPS_HOST="localhost" |
@@ -79,26 +83,10 @@ FL_PSQL_PORT="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Local subkey=Por | |||
79 | FL_PSQL_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Local subkey=User') }}" | 83 | FL_PSQL_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Local subkey=User') }}" |
80 | FL_PSQL_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Local') }}" | 84 | FL_PSQL_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Local') }}" |
81 | 85 | ||
82 | FL_CARRIER_DIRECTORY_DEV_PSQL_HOST="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/CarrierDirectory subkey=Host') }}" | ||
83 | FL_CARRIER_DIRECTORY_DEV_PSQL_PORT="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/CarrierDirectory subkey=Port') }}" | ||
84 | FL_CARRIER_DIRECTORY_DEV_PSQL_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/CarrierDirectory subkey=User') }}" | ||
85 | FL_CARRIER_DIRECTORY_DEV_PSQL_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/CarrierDirectory') }}" | ||
86 | FL_CARRIER_DIRECTORY_DEV_PSQL_DB="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/CarrierDirectory subkey=Database') }}" | ||
87 | |||
88 | FL_GEODATA_DEV_PSQL_HOST="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Geodata subkey=Host') }}" | ||
89 | FL_GEODATA_DEV_PSQL_PORT="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Geodata subkey=Port') }}" | ||
90 | FL_GEODATA_DEV_PSQL_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Geodata subkey=User') }}" | ||
91 | FL_GEODATA_DEV_PSQL_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Geodata') }}" | ||
92 | FL_GEODATA_DEV_PSQL_DB="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Geodata subkey=Database') }}" | ||
93 | |||
94 | FL_NOTIFIER_DEV_PSQL_HOST="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Notifier subkey=Host') }}" | ||
95 | FL_NOTIFIER_DEV_PSQL_PORT="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Notifier subkey=Port') }}" | ||
96 | FL_NOTIFIER_DEV_PSQL_USER="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Notifier subkey=User') }}" | ||
97 | FL_NOTIFIER_DEV_PSQL_PASSWORD="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Notifier') }}" | ||
98 | FL_NOTIFIER_DEV_PSQL_DB="{{ lookup('passwordstore', 'Travail/Fretlink/Psql/Dev/Notifier subkey=Database') }}" | ||
99 | |||
100 | FL_TOOLBOX_AGENT_MACAROON="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/ToolboxAgent') }}" | 86 | FL_TOOLBOX_AGENT_MACAROON="{{ lookup('passwordstore', 'Travail/Fretlink/Macaroons/ToolboxAgent') }}" |
101 | 87 | ||
88 | export FRETLINK_ENV="$APP ${FL_ENV:-local}" | ||
89 | |||
102 | if [ -f "local.env.example" ]; then | 90 | if [ -f "local.env.example" ]; then |
103 | source local.env.example | 91 | source local.env.example |
104 | fi | 92 | fi |
@@ -125,17 +113,12 @@ if [ "$APP" != "app" ]; then | |||
125 | export POSTGRESQL_ADDON_PASSWORD="$FL_PSQL_PASSWORD" | 113 | export POSTGRESQL_ADDON_PASSWORD="$FL_PSQL_PASSWORD" |
126 | export POSTGRESQL_ADDON_DB="$name" | 114 | export POSTGRESQL_ADDON_DB="$name" |
127 | else | 115 | else |
128 | postgresql_host="FL_${name^^}_${FL_ENV^^}_PSQL_HOST" | 116 | key=Psql/$(capitalize $FL_ENV)/$(capitalize $APP) |
129 | postgresql_port="FL_${name^^}_${FL_ENV^^}_PSQL_PORT" | 117 | export POSTGRESQL_ADDON_HOST=$(p $key Host) |
130 | postgresql_user="FL_${name^^}_${FL_ENV^^}_PSQL_USER" | 118 | export POSTGRESQL_ADDON_PORT=$(p $key Port) |
131 | postgresql_password="FL_${name^^}_${FL_ENV^^}_PSQL_PASSWORD" | 119 | export POSTGRESQL_ADDON_USER=$(p $key User) |
132 | postgresql_db="FL_${name^^}_${FL_ENV^^}_PSQL_DB" | 120 | export POSTGRESQL_ADDON_PASSWORD=$(p $key) |
133 | export FRETLINK_ENV="$FL_ENV" | 121 | export POSTGRESQL_ADDON_DB=$(p $key Database) |
134 | export POSTGRESQL_ADDON_HOST="${!postgresql_host}" | ||
135 | export POSTGRESQL_ADDON_PORT="${!postgresql_port}" | ||
136 | export POSTGRESQL_ADDON_USER="${!postgresql_user}" | ||
137 | export POSTGRESQL_ADDON_PASSWORD="${!postgresql_password}" | ||
138 | export POSTGRESQL_ADDON_DB="${!postgresql_db}" | ||
139 | fi | 122 | fi |
140 | fi | 123 | fi |
141 | 124 | ||