initial commit

This commit is contained in:
Finn 2024-02-18 14:30:11 -08:00
commit b950384421
7 changed files with 218 additions and 0 deletions

28
config.go Normal file
View file

@ -0,0 +1,28 @@
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
}