chore(solution): pull lab1 solution

This commit is contained in:
2026-10-29 10:47:47 +03:00
parent 65003b6119
commit 196e118ede
26 changed files with 1424 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
package config
import (
"net"
"os"
)
type Config struct {
Host string
Port string
Env string
}
func Load() Config {
return Config{
Host: getenv("APP_HOST", "0.0.0.0"),
Port: getenv("APP_PORT", "8080"),
Env: getenv("APP_ENV", "lab"),
}
}
func (c Config) Addr() string { return net.JoinHostPort(c.Host, c.Port) }
func getenv(key, def string) string {
if v := os.Getenv(key); v != "" {
return v
}
return def
}