First commit

This commit is contained in:
stef
2025-12-10 11:03:29 +01:00
commit db87e3be3d
18 changed files with 3211 additions and 0 deletions

32
config/config.go Normal file
View File

@@ -0,0 +1,32 @@
package config
import (
"os"
)
type Config struct {
Port string
MongoDBURI string
DBName string
JWTSecret string
Environment string
CertsPath string
}
func LoadConfig() *Config {
return &Config{
Port: getEnv("PORT", "8080"),
MongoDBURI: getEnv("MONGODB_URI", "mongodb://localhost:27017"),
DBName: getEnv("DB_NAME", "pki_db"),
JWTSecret: getEnv("JWT_SECRET", "your-secret-key"),
Environment: getEnv("ENVIRONMENT", "development"),
CertsPath: getEnv("CERTS_PATH", "./certs"),
}
}
func getEnv(key, defaultValue string) string {
if value := os.Getenv(key); value != "" {
return value
}
return defaultValue
}