func NewServer() Server { env := config.NewEnvironment() return Server{ host: env.Host, port: env.Port, } }
func makeAuth() *uaa.UAA { env := config.NewEnvironment() auth := uaa.NewUAA(env.LoginHost, env.UAAHost, env.UAAClientID, env.UAAClientSecret, "") auth.RedirectURL = env.Domain + "/sessions/create" auth.Scope = "openid,cloud_controller.permissions,cloud_controller.read,cloud_controller.write" auth.AccessType = "offline" auth.VerifySSL = env.VerifySSL return &auth }
func init() { env := config.NewEnvironment() if len(env.LogFile) > 0 { file, err := os.OpenFile(env.LogFile, os.O_RDWR|os.O_APPEND, 0660) if err != nil { panic(err) } Logger = log.New(file, "[autoscale] ", log.LstdFlags) ErrorLogger = log.New(file, "[autoscale] ", log.LstdFlags) } else { Logger = log.New(os.Stdout, "\x1b[0m[autoscale] ", log.LstdFlags) ErrorLogger = log.New(os.Stderr, "\x1b[31m[autoscale] ", log.LstdFlags) } }
func (app Application) PrintEnvironment() { env := config.NewEnvironment() viron.Print(env, log.Logger) }