func readEnvChanges(args []string) (env map[string]string, err error) { data := "" stat, err := os.Stdin.Stat() if err != nil { return nil, err } if (stat.Mode() & os.ModeCharDevice) == 0 { in, err := ioutil.ReadAll(os.Stdin) if err != nil { return nil, err } data += string(in) } for _, value := range args { data += fmt.Sprintf("%s\n", value) } env, err = util.ParseEnv(data) if err != nil { return nil, err } return env, nil }
appName, err := util.AppName(cmd) if err != nil { return err } if config.EnvId == "" { return fmt.Errorf("your config does not contain an env_id") } plaintext, err := util.RanchGetSecret(appName, config.EnvId) if err != nil { return err } env, err := util.ParseEnv(plaintext) if err != nil { return err } // sort 'em var keys []string for k, _ := range env { keys = append(keys, k) } sort.Strings(keys) for _, key := range keys { fmt.Printf("%s=%s\n", key, shell.ReadableEscapeArg(env[key])) }