diff --git a/config/config.go b/config/config.go index 3e94962..47c530d 100644 --- a/config/config.go +++ b/config/config.go @@ -5,7 +5,8 @@ import ( ) type ServerConfig struct { - Port string + Port string + ConnectionString string } type Config struct { @@ -15,7 +16,8 @@ type Config struct { func New() *Config { return &Config{ Server: ServerConfig{ - Port: getEnv("PORT", ""), + Port: getEnv("PORT", ""), + ConnectionString: getEnv("CONNECTION_STRING", "test.db"), }, } } diff --git a/deploy/templates/deployment.yaml b/deploy/templates/deployment.yaml index b8f9284..6be00cb 100644 --- a/deploy/templates/deployment.yaml +++ b/deploy/templates/deployment.yaml @@ -27,6 +27,8 @@ spec: value: Europe/Moscow - name: PORT value: {{ .Values.app.server.port | quote }} + - name: CONNECTION_STRING + value: /app/test.db image: {{ .Values.app.image }}:{{ .Chart.AppVersion }} #"docker-registry.dopcore.com/andrusyakka/urban-couscous:latest" imagePullPolicy: Always diff --git a/main.go b/main.go index c05f0e8..832fa7b 100644 --- a/main.go +++ b/main.go @@ -26,7 +26,7 @@ func main() { }, ) - db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{ + db, err := gorm.Open(sqlite.Open(config.Env.Server.ConnectionString), &gorm.Config{ Logger: newLogger, }) if err != nil {