Esempio n. 1
0
func SetScalingoEnv(herokuAppName, scalingoAppName string) error {
	var variables scalingo.Variables

	env, err := getHerokuEnv(herokuAppName)
	if err != nil {
		return errgo.Mask(err)
	}

	for k := range env {
		if strings.TrimSpace(env[k]) == "" {

			io.Warnf("%s has an empty value and couldn't be set\n", k)
		} else {
			variables = append(variables, &scalingo.Variable{
				Name:  k,
				Value: env[k],
			})
		}
	}

	_, _, err = scalingo.VariableMultipleSet(scalingoAppName, variables)
	if err != nil {
		return errgo.Mask(err)
	}

	for _, v := range variables {
		io.Printf("%s has been set to %s\n", v.Name, v.Value)
	}

	return nil
}
Esempio n. 2
0
func main() {
	if len(os.Args) <= 1 {
		io.Error("<Usage>:", os.Args[0], "<app-name>")
	}

	go signals.Handle()

	config.InitHerokuAuth()
	io.Infof("Heroku authentication... ")
	var err error
	HerokuApp, err = config.HerokuClient.AppInfo(os.Args[1])
	if err != nil {
		fmt.Println("ERR")
		io.Error(err)
	}
	fmt.Println("OK")

	io.Infof("Scalingo authentication... ")
	u, err := config.LoadAuthOrLogin()
	if err != nil {
		fmt.Println("ERR")
		io.Error(err)
	}
	fmt.Println("OK")

	io.Printf("You are now logged as %s/%s\n\n", u.Username, u.Email)
	err = CreateScalingoApp()
	if err != nil {
		io.Error(err)
	}

	err = CloneRepository()
	if err != nil {
		io.Error(err)
	}

	err = PushRepository()
	if err != nil {
		io.Error(err)
	}
}