mirror of
https://codeberg.org/video-prize-ranch/rimgo.git
synced 2025-12-13 19:55:21 +00:00
Remove viper and file configuration
This commit is contained in:
43
utils/config.go
Normal file
43
utils/config.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package utils
|
||||
|
||||
import "os"
|
||||
|
||||
var Config map[string]interface{}
|
||||
|
||||
func LoadConfig() {
|
||||
port := "3000"
|
||||
if os.Getenv("PORT") != "" {
|
||||
port = os.Getenv("PORT")
|
||||
}
|
||||
if os.Getenv("RIMGU_PORT") != "" {
|
||||
port = os.Getenv("RIMGU_PORT")
|
||||
}
|
||||
|
||||
fiberPrefork := false
|
||||
if os.Getenv("FIBER_PREFORK") == "true" {
|
||||
fiberPrefork = true
|
||||
}
|
||||
|
||||
addr := "0.0.0.0"
|
||||
if os.Getenv("ADDRESS") != "" {
|
||||
addr = os.Getenv("ADDRESS")
|
||||
}
|
||||
if os.Getenv("RIMGU_ADDRESS") != "" {
|
||||
addr = os.Getenv("RIMGU_ADDRESS")
|
||||
}
|
||||
|
||||
imgurId := "546c25a59c58ad7"
|
||||
if os.Getenv("IMGUR_CLIENT_ID") != "" {
|
||||
imgurId = os.Getenv("IMGUR_CLIENT_ID")
|
||||
}
|
||||
if os.Getenv("RIMGU_IMGUR_CLIENT_ID") != "" {
|
||||
imgurId = os.Getenv("RIMGU_IMGUR_CLIENT_ID")
|
||||
}
|
||||
|
||||
Config = map[string]interface{}{
|
||||
"port": port,
|
||||
"addr": addr,
|
||||
"imgurId": imgurId,
|
||||
"fiberPrefork": fiberPrefork,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user