Skip to content
Snippets Groups Projects
Commit 66bb03f8 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6747 set different config profiles

parent aa29268c
No related branches found
No related tags found
No related merge requests found
......@@ -75,6 +75,7 @@ tools { go 'go-1.22.0' }
chmod +x ./buf
./buf generate
#to compile go statically with these tags, so that the binary is not dynamically linked and from scratch in Dockerfile will work
APP_ENV=production
go build -tags osusergo,netgo cmd/antragsraum-proxy/main.go
'''
......
......@@ -29,12 +29,16 @@ import (
"antragsraum-proxy/internal/config"
"antragsraum-proxy/internal/mock"
"antragsraum-proxy/internal/server"
"fmt"
)
var version = "v1.1.0-beta.1"
func main() {
conf := config.LoadConfig()
fmt.Printf("HTTP Server Port: %d\n", conf.Http.Server.Port)
fmt.Printf("gRPC Server Port: %d\n", conf.Grpc.Server.Port)
fmt.Printf("Logging Level: %s\n", conf.Logging.Level)
if conf.Grpc.Server.Mock {
go mock.StartGrpcServer()
......
File moved
http:
server:
port: 8082
grpc:
server:
mock: false
port: 9090
router:
port: 50051
logging:
level: "INFO"
\ No newline at end of file
......@@ -31,40 +31,45 @@ import (
"log"
"os"
"testing"
"fmt"
)
const (
defaultFilePath = "config/config.yml"
defaultEnv = "development"
testFilePath = "testdata/test_config.yml"
)
type Config struct {
Http struct {
Server struct {
Port int `yaml:"port" envconfig:"HTTP_SERVER_PORT"`
Port int `yaml:"port"`
} `yaml:"server"`
} `yaml:"http"`
Grpc struct {
Server struct {
Mock bool `yaml:"mock" envconfig:"GRPC_SERVER_MOCK"`
Mock bool `yaml:"mock"`
Port int `yaml:"port" envconfig:"GRPC_SERVER_PORT"`
} `yaml:"server"`
Router struct {
Port int `yaml:"port" envconfig:"GRPC_ROUTER_PORT"`
Port int `yaml:"port"`
} `yaml:"router"`
} `yaml:"grpc"`
Logging struct {
Level string `yaml:"level" envconfig:"LOGGING_LEVEL"`
Level string `yaml:"level"`
} `yaml:"logging"`
}
func LoadConfig(configFilePath ...string) Config {
func LoadConfig() Config {
var config Config
fp := defaultFilePath
if len(configFilePath) > 0 {
fp = configFilePath[0]
} else if testing.Testing() {
env := os.Getenv("APP_ENV")
if env == "" {
env = defaultEnv
}
fp := fmt.Sprintf("config/config-%s.yml", env)
if testing.Testing() {
fp = testFilePath
}
......
......@@ -58,14 +58,8 @@ spec:
app.kubernetes.io/name: {{ .Release.Name }}
containers:
- env:
- name: LOGGING_LEVEL
value: "INFO"
- name: HTTP_SERVER_PORT
value: "8082"
- name: GRPC_SERVER_MOCK
value: "false"
- name: GRPC_SERVER_PORT
value: "9090"
value: "{{ .Values.grpc.server.port }}"
{{- with include "app.getCustomList" . }}
{{ . | indent 10 }}
{{- end }}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment