From f9ab56073615708c4e97077018f85835db31659a Mon Sep 17 00:00:00 2001 From: hunterlong Date: Fri, 15 May 2020 17:21:54 -0700 Subject: [PATCH] including NAME, DESCRIPTION, and DOMAIN env vars to be used when Statping is setup (automatically), modified docker-compose full stack yml. --- dev/docker-compose.full.yml | 18 +++++++++++++++--- types/core/samples.go | 6 +++--- utils/configs.go | 3 +++ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/dev/docker-compose.full.yml b/dev/docker-compose.full.yml index eb35cbc7..6c326ecb 100644 --- a/dev/docker-compose.full.yml +++ b/dev/docker-compose.full.yml @@ -13,6 +13,10 @@ version: '2.3' # Prometheus => http://localhost:7050 # Grafana => http://localhost:3000 # +# MySQL => http://localhost:3306 +# Postgres => http://localhost:5432 +# MariaDB => http://localhost:3307 +# ############################################### services: @@ -24,6 +28,7 @@ services: restart: on-failure volumes: - ./docker/statping/sqlite:/app + - ./services.yml:/app/services.yml environment: DB_CONN: sqlite API_SECRET: exampleapisecret @@ -32,6 +37,7 @@ services: DESCRIPTION: This is a dev environment on SQLite! ADMIN_USER: admin ADMIN_PASS: admin + SAMPLE_DATA: 'false' ports: - 8080:8080 networks: @@ -50,6 +56,7 @@ services: restart: on-failure volumes: - ./docker/statping/mysql:/app + - ./services.yml:/app/services.yml environment: DB_CONN: mysql DB_HOST: mysql @@ -59,10 +66,11 @@ services: DB_PORT: 3306 API_SECRET: exampleapisecret NAME: Statping MySQL - DOMAIN: http://localhost:8080 + DOMAIN: http://localhost:8081 DESCRIPTION: This is a dev environment on MySQL! ADMIN_USER: admin ADMIN_PASS: admin + SAMPLE_DATA: 'false' ports: - 8081:8080 networks: @@ -84,6 +92,7 @@ services: restart: on-failure volumes: - ./docker/statping/mysql:/app + - ./services.yml:/app/services.yml environment: DB_CONN: postgres DB_HOST: postgres @@ -93,10 +102,11 @@ services: DB_PORT: 5432 API_SECRET: exampleapisecret NAME: Statping Postgres - DOMAIN: http://localhost:8080 + DOMAIN: http://localhost:8082 DESCRIPTION: This is a dev environment on Postgres! ADMIN_USER: admin ADMIN_PASS: admin + SAMPLE_DATA: 'false' ports: - 8082:8080 networks: @@ -118,6 +128,7 @@ services: restart: on-failure volumes: - ./docker/statping/mariadb:/app + - ./services.yml:/app/services.yml environment: DB_CONN: mysql DB_HOST: mariadb @@ -127,10 +138,11 @@ services: DB_PORT: 3306 API_SECRET: exampleapisecret NAME: Statping MariaDB - DOMAIN: http://localhost:8080 + DOMAIN: http://localhost:8083 DESCRIPTION: This is a dev environment on MariaDB! ADMIN_USER: admin ADMIN_PASS: admin + SAMPLE_DATA: 'false' ports: - 8083:8080 networks: diff --git a/types/core/samples.go b/types/core/samples.go index 431cc6ba..57d8dd1d 100644 --- a/types/core/samples.go +++ b/types/core/samples.go @@ -13,10 +13,10 @@ func Samples() error { } core := &Core{ - Name: "Statping Sample Data", - Description: "This data is only used to testing", + Name: utils.Params.GetString("NAME"), + Description: utils.Params.GetString("DESCRIPTION"), ApiSecret: apiSecret, - Domain: "http://localhost:8080", + Domain: utils.Params.GetString("DOMAIN"), CreatedAt: utils.Now(), UseCdn: null.NewNullBool(false), Footer: null.NewNullString(""), diff --git a/utils/configs.go b/utils/configs.go index 477a7894..c63ee3cd 100644 --- a/utils/configs.go +++ b/utils/configs.go @@ -54,6 +54,9 @@ func setDefaults() { Params.SetDefault("USE_CDN", false) Params.SetDefault("ALLOW_REPORTS", false) Params.SetDefault("POSTGRES_SSLMODE", "disable") + Params.SetDefault("NAME", "Statping Sample Data") + Params.SetDefault("DOMAIN", "http://localhost:8080") + Params.SetDefault("DESCRIPTION", "This status page has sample data included") Params.SetDefault("REMOVE_AFTER", 2160*time.Hour) Params.SetDefault("CLEANUP_INTERVAL", 1*time.Hour)