Wire everything together, config and transaction implementation
This commit is contained in:
29
internal/config/config.go
Normal file
29
internal/config/config.go
Normal file
@@ -0,0 +1,29 @@
|
||||
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"`
|
||||
ALLOWED_ORIGINS []string `json:"allowed_origins"`
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user