Skip to content
Merged

Env #312

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ Examples:
$ scw exec myserver bash
$ scw exec --gateway=myotherserver myserver bash
$ scw exec myserver 'tmux a -t joe || tmux new -s joe || bash'
$ exec_secure=1 scw exec myserver bash
$ SCW_SECURE_EXEC=1 scw exec myserver bash
$ scw exec -w $(scw start $(scw create ubuntu-trusty)) bash
$ scw exec $(scw start -w $(scw create ubuntu-trusty)) bash
$ scw exec myserver tmux new -d sleep 10
Expand Down Expand Up @@ -1183,6 +1183,8 @@ $ scw inspect myserver | jq '.[0].public_ip.address'

### master (unreleased)

* Use `SCW_SECURE_EXEC` instead of `exec_exec`
* Remove `scaleway_api_endpoint` environment variable
* `scw login` don't ask to upload ssh key when there is no keys

View full [commits list](https://github.com/scaleway/scaleway-cli/compare/v1.8.0...master)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/cmd_exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var cmdExec = &Command{
$ scw exec myserver bash
$ scw exec --gateway=myotherserver myserver bash
$ scw exec myserver 'tmux a -t joe || tmux new -s joe || bash'
$ exec_secure=1 scw exec myserver bash
$ SCW_SECURE_EXEC=1 scw exec myserver bash
$ scw exec -w $(scw start $(scw create ubuntu-trusty)) bash
$ scw exec $(scw start -w $(scw create ubuntu-trusty)) bash
$ scw exec myserver tmux new -d sleep 10
Expand Down
7 changes: 0 additions & 7 deletions pkg/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,6 @@ func Start(rawArgs []string, streams *commands.Streams) (int, error) {
return 1, fmt.Errorf("unable to open .scwrc config file: %v", cfgErr)
}

if config != nil {
defaultComputeAPI := os.Getenv("scaleway_api_endpoint")
if defaultComputeAPI == "" {
defaultComputeAPI = config.ComputeAPI
}
}

if *flVersion {
fmt.Fprintf(streams.Stderr, "scw version %s, build %s\n", scwversion.VERSION, scwversion.GITCOMMIT)
return 0, nil
Expand Down
3 changes: 2 additions & 1 deletion pkg/commands/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/kardianos/osext"

"github.com/scaleway/scaleway-cli/pkg/api"
"github.com/scaleway/scaleway-cli/pkg/config"
)

Expand All @@ -25,7 +26,7 @@ func RunInfo(ctx CommandContext, args InfoArgs) error {

fmt.Fprintf(ctx.Stdout, "Organization:\t\t%s\n", ctx.API.Organization)
// FIXME: add partially-masked token
fmt.Fprintf(ctx.Stdout, "API Endpoint:\t\t%s\n", ctx.Getenv("scaleway_api_endpoint"))
fmt.Fprintf(ctx.Stdout, "API Endpoint:\t\t%s\n", api.ComputeAPI)
configPath, _ := config.GetConfigFilePath()
fmt.Fprintf(ctx.Stdout, "RC file:\t\t%s\n", configPath)
fmt.Fprintf(ctx.Stdout, "User:\t\t\t%s\n", ctx.Getenv("USER"))
Expand Down
3 changes: 0 additions & 3 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ func GetConfig() (*Config, error) {
config.AccountAPI = "https://account.scaleway.com"
config.Save()
}
if os.Getenv("scaleway_api_endpoint") == "" {
os.Setenv("scaleway_api_endpoint", config.ComputeAPI)
}
return &config, nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func SSHExec(publicIPAddress string, privateIPAddress string, command []string,
// NewSSHExecCmd computes execve compatible arguments to run a command via ssh
func NewSSHExecCmd(publicIPAddress string, privateIPAddress string, allocateTTY bool, command []string, gatewayIPAddress string) *sshcommand.Command {
quiet := os.Getenv("DEBUG") != "1"
secureExec := os.Getenv("exec_secure") == "1"
secureExec := os.Getenv("SCW_SECURE_EXEC") == "1"
sshCommand := &sshcommand.Command{
AllocateTTY: true,
Command: command,
Expand Down