Files
link-shortening-service/internal/config/config.go
KoCoder 8f1e292995
All checks were successful
Build and Push Docker Image / build (push) Successful in 5m53s
Get the port from the json config
2026-06-02 22:08:47 +02:00

29 lines
471 B
Go

package config
import (
"encoding/json"
"os"
)
type Config struct {
DB_URL string `json:"db_url"`
LISTEN_ON string `json:"listen_on"`
TRUSTED_PROXIES []string `json:"trusted_proxies"`
OTLP_ENDPOINT string `json:"otlp_endpoint"`
}
func Read() *Config {
file, err := os.ReadFile("./settings.json")
if err != nil {
panic(err)
}
var config Config
err = json.Unmarshal(file, &config)
if err != nil {
panic(err)
}
return &config
}