initial commit
This commit is contained in:
commit
b950384421
7 changed files with 218 additions and 0 deletions
28
config.go
Normal file
28
config.go
Normal 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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue