Skip to content

Commit d96ee88

Browse files
committed
feat: taito-domain-config.sh, taito-environments-config.sh
1 parent 1558ff9 commit d96ee88

File tree

6 files changed

+88
-46
lines changed

6 files changed

+88
-46
lines changed

scripts/taito-template/common.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ sed -i "s/taito_suffix=.*/taito_suffix=${taito_suffix:-}/g" taito-config.sh
7979
sed -i "s/taito_project=.*/taito_project=${taito_vc_repository}/g" taito-config.sh
8080

8181
echo "Replacing template variables with the user specific settings..."
82-
sed -i "s/\${template_default_environments:?}/${template_default_environments}/g" taito-config.sh
82+
sed -i "s/\${template_default_environments:?}/${template_default_environments}/g" taito-environments-config.sh
8383
sed -i "s/\${template_default_organization:?}/${template_default_organization}/g" taito-config.sh
8484
sed -i "s/\${template_default_organization_abbr:?}/${template_default_organization_abbr}/g" taito-config.sh
8585
sed -i "s/\${template_default_vc_organization:?}/${template_default_vc_organization}/g" taito-config.sh

taito-config.sh

Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
set -a
44
: "${taito_target_env:?}"
55

6-
# Configuration instructions:
7-
# - https://taito.dev/docs/05-configuration
8-
# - https://taito.dev/plugins
6+
##########################################################################
7+
# Root taito-config.sh file
8+
##########################################################################
9+
10+
# ------------------------------------------------------------------------
11+
# NOTE: This file is updated during 'taito project upgrade'. There should
12+
# rarely be need to modify it manually. Modify taito-domain-config.sh,
13+
# taito-environments-config.sh or taito-test-config.sh instead.
14+
# ------------------------------------------------------------------------
915

1016
# Taito CLI
1117
taito_version=1
@@ -32,7 +38,6 @@ taito_suffix=
3238
taito_project_icon=$taito_project-dev.${template_default_domain:?}/favicon.ico
3339

3440
# Environments
35-
taito_environments="${template_default_environments:?}"
3641
taito_env=${taito_target_env/canary/prod} # canary -> prod
3742

3843
# Provider and namespaces
@@ -150,7 +155,6 @@ kubernetes_db_proxy_enabled=true
150155
case $taito_env in
151156
prod)
152157
# Settings
153-
taito_basic_auth_enabled=true
154158
kubernetes_replicas=2
155159

156160
# Provider and namespaces
@@ -162,7 +166,6 @@ case $taito_env in
162166
taito_resource_namespace=$taito_organization_abbr-$taito_company-prod
163167

164168
# Domain and resources
165-
taito_domain=
166169
taito_domain=$taito_project-$taito_target_env.${template_default_domain_prod:?} # TEMPLATE-REMOVE
167170
taito_default_domain=$taito_project-$taito_target_env.${template_default_domain_prod:?}
168171
taito_app_url=https://$taito_domain
@@ -187,6 +190,9 @@ case $taito_env in
187190
taito_container_registry=${template_default_container_registry_prod:-}/$taito_vc_repository
188191
taito_ci_provider=${template_default_ci_provider_prod:?}
189192
ci_exec_deploy=${template_default_ci_exec_deploy_prod:-true}
193+
194+
# shellcheck disable=SC1091
195+
. taito-domain-config.sh
190196
;;
191197
stag)
192198
# Settings
@@ -259,25 +265,6 @@ if [[ "$taito_env" == "local" ]]; then
259265
taito_storage_url=http://localhost:9999/minio
260266
fi
261267

262-
# Link plugin
263-
link_urls="
264-
* client[:ENV]=$taito_app_url Application GUI (:ENV)
265-
* admin[:ENV]=$taito_admin_url Admin GUI (:ENV)
266-
* server[:ENV]=$taito_app_url/api/uptimez Server API (:ENV)
267-
* apidocs[:ENV]=$taito_app_url/api/docs API Docs (:ENV)
268-
* www[:ENV]=$taito_app_url/docs Generated documentation (:ENV)
269-
* graphql[:ENV]=$taito_app_url/graphql/uptimez GraphQL API (:ENV)
270-
* git=https://$taito_vc_repository_url Git repository
271-
* storage:ENV=$taito_storage_url Storage bucket (:ENV)
272-
* styleguide=https://TODO UI/UX style guide and designs
273-
* wireframes=https://TODO UI/UX wireframes
274-
* feedback=https://TODO User feedback
275-
* performance=https://TODO Performance metrics
276-
"
277-
278-
# TODO: Temporary hack for https://github.com/gatsbyjs/gatsby/issues/3721
279-
link_urls=${link_urls/:9999\/docs/:7463\/docs/}
280-
281268
# ------ Database users ------
282269

283270
# app user for application
@@ -292,25 +279,13 @@ db_database_mgr_secret="${db_database_name//_/-}-db-mgr.password"
292279
db_database_master_username="${template_default_postgres_master_username:-}"
293280
db_database_master_password_hint="${template_default_postgres_master_password_hint:-}"
294281

295-
# ------ Secrets ------
282+
# ------ Environments config ------
296283

297-
taito_remote_secrets="
298-
$taito_project-$taito_env-basic-auth.auth:htpasswd-plain
299-
$taito_project-$taito_env-scheduler.secret:random
300-
"
301-
taito_secrets="
302-
$db_database_app_secret:random
303-
$taito_project-$taito_env-storage-gateway.secret:random
304-
$taito_project-$taito_env-example.secret:manual
305-
"
284+
# shellcheck disable=SC1091
285+
. taito-environments-config.sh
306286

307-
# Define database mgr password for automatic CI/CD deployments
308-
if [[ $ci_exec_deploy == "true" ]]; then
309-
taito_remote_secrets="
310-
$taito_remote_secrets
311-
$db_database_mgr_secret/devops:random
312-
"
313-
fi
287+
# TODO: Temporary hack for https://github.com/gatsbyjs/gatsby/issues/3721
288+
link_urls=${link_urls/:9999\/docs/:7463\/docs/}
314289

315290
# ------ Taito config override (optional) ------
316291

taito-domain-config.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
# shellcheck disable=SC2034
3+
4+
##########################################################################
5+
# Domain settings for production environment
6+
##########################################################################
7+
8+
taito_domain=
9+
taito_basic_auth_enabled=true

taito-environments-config.sh

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#!/bin/bash
2+
# shellcheck disable=SC2034
3+
4+
##########################################################################
5+
# Environment settings
6+
##########################################################################
7+
8+
# Environments
9+
taito_environments="${template_default_environments:?}"
10+
11+
# Links
12+
link_urls="
13+
* client[:ENV]=$taito_app_url Application GUI (:ENV)
14+
* admin[:ENV]=$taito_admin_url Admin GUI (:ENV)
15+
* server[:ENV]=$taito_app_url/api/uptimez Server API (:ENV)
16+
* apidocs[:ENV]=$taito_app_url/api/docs API Docs (:ENV)
17+
* www[:ENV]=$taito_app_url/docs Generated documentation (:ENV)
18+
* graphql[:ENV]=$taito_app_url/graphql/uptimez GraphQL API (:ENV)
19+
* git=https://$taito_vc_repository_url Git repository
20+
* storage:ENV=$taito_storage_url Storage bucket (:ENV)
21+
* styleguide=https://TODO UI/UX style guide and designs
22+
* wireframes=https://TODO UI/UX wireframes
23+
* feedback=https://TODO User feedback
24+
* performance=https://TODO Performance metrics
25+
"
26+
27+
# ------ Secrets ------
28+
29+
# Configuration instructions:
30+
# https://taitounited.github.io/taito-cli/tutorial/06-env-variables-and-secrets/
31+
32+
taito_remote_secrets="
33+
$taito_project-$taito_env-basic-auth.auth:htpasswd-plain
34+
$taito_project-$taito_env-scheduler.secret:random
35+
"
36+
taito_secrets="
37+
$db_database_app_secret:random
38+
$taito_project-$taito_env-storage-gateway.secret:random
39+
$taito_project-$taito_env-example.secret:manual
40+
"
41+
42+
# Define database mgr password for automatic CI/CD deployments
43+
if [[ $ci_exec_deploy == "true" ]]; then
44+
taito_remote_secrets="
45+
$taito_remote_secrets
46+
$db_database_mgr_secret/devops:random
47+
"
48+
fi

taito-provider-config.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
#!/bin/bash
22
# shellcheck disable=SC2034
33

4-
# NOTE: These settings have been copied from SERVER-TEMPLATE.
5-
# Do not modify them. Improve the original settings instead.
4+
##########################################################################
5+
# Provider specific settings
6+
##########################################################################
7+
8+
# ------------------------------------------------------------------------
9+
# NOTE: This file is updated during 'taito project upgrade'. There should
10+
# be no need to modify it manually. Modify taito-domain-config.sh,
11+
# taito-environments-config.sh or taito-test-config.sh instead.
12+
# ------------------------------------------------------------------------
613

714
case $taito_provider in
815
aws)

taito-test-config.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/bin/bash
22
# shellcheck disable=SC2034
33

4-
# NOTE: Variable is passed to the test without the test_TARGET_ prefix
4+
##########################################################################
5+
# Integration and end-to-end test parameters
6+
# NOTE: Variables are passed to the tests without the test_TARGET_ prefix.
7+
##########################################################################
58

69
# Database connection
710
test_all_DATABASE_HOST=$taito_project-database-test-proxy

0 commit comments

Comments
 (0)