re-write with std usage of net/http
This commit is contained in:
parent
c107d94b11
commit
81bc046237
10 changed files with 419 additions and 97 deletions
28
internal/config/config.go
Normal file
28
internal/config/config.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Port string
|
||||
StaticDir string
|
||||
Environment string
|
||||
}
|
||||
|
||||
var AppConfig Config
|
||||
|
||||
func Load() {
|
||||
AppConfig = Config{
|
||||
Port: getEnv("PORT", "7878"),
|
||||
StaticDir: getEnv("STATIC_DIR", "static"),
|
||||
Environment: getEnv("ENVIRONMENT", "development"),
|
||||
}
|
||||
}
|
||||
|
||||
func getEnv(key, fallback string) string {
|
||||
if value, ok := os.LookupEnv(key); ok {
|
||||
return value
|
||||
}
|
||||
return fallback
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue