func convoxClient() (*client.Client, error) { if !viper.IsSet("convox.host") || !viper.IsSet("convox.password") { return nil, fmt.Errorf("must set 'convox.host' and 'convox.password' in $HOME/.ranch.yaml") } host := viper.GetString("convox.host") password := viper.GetString("convox.password") version := "20151211151200" return client.New(host, password, version), nil }
func ecruClient() (*gorequest.SuperAgent, error) { if !viper.IsSet("convox.password") { return nil, fmt.Errorf("must set 'convox.password' in $HOME/.ranch.yaml") } request := jsonClient(). SetBasicAuth(viper.GetString("convox.password"), "x-auth-token") return request, nil }
func whichLicense() string { // if explicitly flagged, use that if userLicense != "" { return matchLicense(userLicense) } // if already present in the project, use that // TODO: Inspect project for existing license // default to viper's setting return matchLicense(viper.GetString("license")) }
func ranchClient() *gorequest.SuperAgent { authToken := viper.GetString("token") return jsonClient(). SetBasicAuth(authToken, "x-auth-token") }
func ranchUrl(pathname string) string { u, _ := url.Parse(viper.GetString("endpoint")) u.Path = path.Join(u.Path, pathname) return u.String() }
func copyrightLine() string { author := viper.GetString("author") year := time.Now().Format("2006") return "Copyright © " + year + " " + author }