feat: bootstrap temporserv project scaffold
Add the initial project blueprint, Go backend skeleton, frontend app shell, database schema draft, and local development/deployment files.
This commit is contained in:
36
internal/config/config.go
Normal file
36
internal/config/config.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package config
|
||||
|
||||
import "os"
|
||||
|
||||
type Config struct {
|
||||
AppEnv string
|
||||
ServerHost string
|
||||
ServerPort string
|
||||
DatabasePath string
|
||||
MediaRoot string
|
||||
CORSOrigins string
|
||||
}
|
||||
|
||||
func Load() Config {
|
||||
return Config{
|
||||
AppEnv: getenv("APP_ENV", "development"),
|
||||
ServerHost: getenv("SERVER_HOST", "0.0.0.0"),
|
||||
ServerPort: getenv("SERVER_PORT", "4040"),
|
||||
DatabasePath: getenv("DATABASE_PATH", "./data/app.db"),
|
||||
MediaRoot: getenv("MEDIA_ROOT", "./media"),
|
||||
CORSOrigins: getenv("CORS_ORIGINS", "http://localhost:5173"),
|
||||
}
|
||||
}
|
||||
|
||||
func (c Config) Address() string {
|
||||
return c.ServerHost + ":" + c.ServerPort
|
||||
}
|
||||
|
||||
func getenv(key, fallback string) string {
|
||||
value := os.Getenv(key)
|
||||
if value == "" {
|
||||
return fallback
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user