Skip to content
Snippets Groups Projects
Commit 7d65af88 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6747 refactor config files

parent 900e69e9
No related branches found
No related tags found
No related merge requests found
File moved
File moved
......@@ -34,7 +34,7 @@ import (
)
const (
defaultEnv = "development"
defaultConfig = "config.yml"
testFilePath = "testdata/test_config.yml"
)
......@@ -61,12 +61,14 @@ type Config struct {
func LoadConfig(configFilePath ...string) Config {
var config Config
configFile := defaultConfig
env := os.Getenv("APP_ENV")
if env == "" {
env = defaultEnv
if env != "" {
configFile = fmt.Sprintf("config-%s.yml", env)
}
fp := fmt.Sprintf("config/config-%s.yml", env)
fp := fmt.Sprintf("config/%s", configFile)
if len(configFilePath) > 0 {
fp = configFilePath[0]
......
......@@ -59,7 +59,7 @@ spec:
containers:
- env:
- name: APP_ENV
value: "production"
value: "{{ .Values.appEnv | default "dev" }}"
{{- with include "app.getCustomList" . }}
{{ . | indent 10 }}
{{- end }}
......
......@@ -69,4 +69,13 @@ tests:
path: spec.template.spec.containers[0].env
content:
name: APP_ENV
value: "production"
\ No newline at end of file
value: "dev"
- it: should set APP_ENV
set:
appEnv: prod
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: APP_ENV
value: "prod"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment