From a88946bb7fcfc1632661eafc84eac0aa1c2573c3 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Wed, 24 Jul 2024 01:07:11 -0400 Subject: Update server configuration to disable serving frontend --- config/config.go | 3 +++ config/local.yaml | 1 + config/selfhosted.yaml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 config/selfhosted.yaml (limited to 'config') diff --git a/config/config.go b/config/config.go index fc21b49..b38e808 100644 --- a/config/config.go +++ b/config/config.go @@ -48,6 +48,7 @@ type ServerConfig struct { ReadTimeout time.Duration `mapstructure:"read_timeout" yaml:"read_timeout"` WriteTimeout time.Duration `mapstructure:"write_timeout" yaml:"write_timeout"` CorsAllowOrigins []string `mapstructure:"cors_allow_origins" yaml:"cors_allow_origins"` + ServeFrontend bool `mapstructure:"serve_frontend" yaml:"serve_frontend"` } type SchedulerConfig struct { @@ -105,6 +106,8 @@ func LoadConfig() *Config { viper.SetConfigName("local") } else if os.Getenv("CA_ENV") == "prod" { viper.SetConfigName("prod") + } else if os.Getenv("CA_ENV") == "selfhosted" { + viper.SetConfigName("selfhosted") } else { viper.SetConfigName("local") } diff --git a/config/local.yaml b/config/local.yaml index fb25d49..33e5a3d 100644 --- a/config/local.yaml +++ b/config/local.yaml @@ -18,6 +18,7 @@ server: cors_allow_origins: - "http://localhost:5173" - "http://localhost:7926" + serve_frontend: false scheduler_jobs: due_job: 30m overdue_job: 3h diff --git a/config/selfhosted.yaml b/config/selfhosted.yaml new file mode 100644 index 0000000..09e4cb2 --- /dev/null +++ b/config/selfhosted.yaml @@ -0,0 +1,31 @@ +name: "local" +is_done_tick_dot_com: false +telegram: + token: "" +database: + type: "sqlite" + migration: true +jwt: + secret: "secret" + session_time: 168h + max_refresh: 168h +server: + port: 2021 + read_timeout: 2s + write_timeout: 1s + rate_period: 60s + rate_limit: 300 + cors_allow_origins: + - "http://localhost:5173" + - "http://localhost:7926" + serve_frontend: true +scheduler_jobs: + due_job: 30m + overdue_job: 3h + pre_due_job: 3h +email: + host: + port: + key: + email: + appHost: -- cgit From be98920271e9f1a8becb1dbf91be721380a81bb3 Mon Sep 17 00:00:00 2001 From: Mo Tarbin Date: Wed, 24 Jul 2024 01:09:58 -0400 Subject: Update environment variable names in config and docker-compose --- config/config.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'config') diff --git a/config/config.go b/config/config.go index b38e808..52ed1db 100644 --- a/config/config.go +++ b/config/config.go @@ -102,17 +102,17 @@ func configEnvironmentOverrides(Config *Config) { func LoadConfig() *Config { // set the config name based on the environment: - if os.Getenv("CA_ENV") == "local" { + if os.Getenv("DT_ENV") == "local" { viper.SetConfigName("local") - } else if os.Getenv("CA_ENV") == "prod" { + } else if os.Getenv("DT_ENV") == "prod" { viper.SetConfigName("prod") - } else if os.Getenv("CA_ENV") == "selfhosted" { + } else if os.Getenv("DT_ENV") == "selfhosted" { viper.SetConfigName("selfhosted") } else { viper.SetConfigName("local") } // get logger and log the current environment: - fmt.Printf("--ConfigLoad config for environment: %s ", os.Getenv("CA_ENV")) + fmt.Printf("--ConfigLoad config for environment: %s ", os.Getenv("DT_ENV")) viper.AddConfigPath("./config") viper.SetConfigType("yaml") -- cgit