28 lines
605 B
Go
28 lines
605 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
type Config struct {
|
|
Bind string `json:"bind"`
|
|
S3Endpoint string `json:"s3_endpoint"`
|
|
AccessKeyID string `json:"access_key_id"`
|
|
SecretAccessKey string `json:"secret_access_key"`
|
|
}
|
|
|
|
var config = Config{
|
|
Bind: getEnvWithDefault("BIND", ":5000"),
|
|
S3Endpoint: os.Getenv("S3_ENDPOINT"),
|
|
AccessKeyID: os.Getenv("ACCESS_KEY_ID"),
|
|
SecretAccessKey: os.Getenv("SECRET_ACCESS_KEY"),
|
|
}
|
|
|
|
func getEnvWithDefault(env string, defaultValue string) string {
|
|
value := os.Getenv(env)
|
|
if value == "" {
|
|
return defaultValue
|
|
}
|
|
|
|
return value
|
|
}
|