utils

package
v0.0.0-...-b770fee Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2018 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvDef

func EnvDef(name, def string) string

func EnvDefInt

func EnvDefInt(name string, def int) int

func EnvEnsure

func EnvEnsure(name string) string

func EnvInt

func EnvInt(name string) int

func Host

func Host(name string, port int) string

func HostDef

func HostDef(name string, port int, def string) string

Types

type Config

type Config struct {
	Flavor     string
	Production bool
	Port       string

	PostgresqlHost     string
	PostgresqlPort     int
	PostgresqlDbName   string
	PostgresqlUser     string
	PostgresqlPassword string
	PostgresqlSslMode  string

	StripeSecretLive string
	StripeSecretTest string

	AWSBucket          string
	AWSRegion          string
	AWSAccessKeyId     string // Unused, just used to remind you to set the env
	AWSSecretAccessKey string // vars AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
}
var Conf Config = Config{
	Flavor:     os.Getenv("FLAVOR"),
	Production: os.Getenv("FLAVOR") == "production",
	Port:       EnvDef("PORT", "8000"),

	PostgresqlHost:     HostDef("GRADIENTZOO_POSTGRES_SVC", EnvDefInt("POSTGRESQL_PORT", 5432), "localhost"),
	PostgresqlPort:     EnvDefInt("POSTGRESQL_PORT", 5432),
	PostgresqlDbName:   EnvDef("POSTGRESQL_NAME", "gradientzoo"),
	PostgresqlUser:     EnvDef("POSTGRESQL_USER", "gradientzoo"),
	PostgresqlPassword: EnvDef("POSTGRESQL_PASSWORD", "gradientzoo"),
	PostgresqlSslMode:  EnvDef("POSTGRESQL_SSLMODE", "disable"),

	StripeSecretLive: EnvDef("STRIPE_SECRET_LIVE", ""),
	StripeSecretTest: EnvDef("STRIPE_SECRET_TEST", ""),

	AWSBucket:          EnvDef("AWS_BUCKET", "gradientzoo-1"),
	AWSRegion:          EnvDef("AWS_REGION", "us-west-2"),
	AWSAccessKeyId:     EnvDef("AWS_ACCESS_KEY_ID", ""),
	AWSSecretAccessKey: EnvDef("AWS_SECRET_ACCESS_KEY", ""),
}

func (Config) Valid

func (c Config) Valid() bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL