import sources from develop/0.1.0

This commit is contained in:
Thomas Peetz
2025-04-29 12:52:55 +02:00
parent 304005822c
commit 4c96de27db
976 changed files with 58265 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
package config
import "os"
// AppConfig is the Application configuration struct
type AppConfig struct {
Name string
Version string
Token string
}
// HTTPConfig is the Application HTTP configuration
type HTTPConfig struct {
Content string
Problem string
Port string
}
// Config is the Configuration struct
type Config struct {
App AppConfig
HTTP HTTPConfig
}
// New returns a new Config Struct
func New() *Config {
return &Config{
App: AppConfig{
Name: env("APP_NAME", "Kontor"),
Version: env("APP_VERSION", "v1.0"),
Token: env("APP_TOKEN", ""),
},
HTTP: HTTPConfig{
Content: env("HTTP_CONTENT_TYPE", "application/json"),
Problem: env("HTTP_PROBLEM", "application/problem+json"),
Port: env("HTTP_PORT", ":8086"),
},
}
}
// env is a simple helper function to read an environment variable or return a default value
func env(key string, defaultValue string) string {
if value, exists := os.LookupEnv(key); exists {
return value
}
return defaultValue
}