forked from mtusi2026/mtusi2026lab2
feat: migrate backend to Golang (Gin + GORM)
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package config
|
||||
|
||||
import "os"
|
||||
|
||||
type Config struct {
|
||||
Port string
|
||||
DatabaseURL string
|
||||
SessionTTLSeconds int
|
||||
}
|
||||
|
||||
func Load() *Config {
|
||||
port := os.Getenv("APP_PORT")
|
||||
if port == "" {
|
||||
port = "8080"
|
||||
}
|
||||
|
||||
dbURL := os.Getenv("DATABASE_URL")
|
||||
if dbURL == "" {
|
||||
dbURL = "postgresql://postgres:postgres@postgres:5432/messenger"
|
||||
}
|
||||
|
||||
return &Config{
|
||||
Port: port,
|
||||
DatabaseURL: dbURL,
|
||||
SessionTTLSeconds: 3600,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user