Skip to content

Commit 6fc6ea8

Browse files
committed
Merge pull request #312 from QuentinPerez/env
Env
2 parents 98c7c43 + a1d9a62 commit 6fc6ea8

File tree

6 files changed

+7
-14
lines changed

6 files changed

+7
-14
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ Examples:
369369
$ scw exec myserver bash
370370
$ scw exec --gateway=myotherserver myserver bash
371371
$ scw exec myserver 'tmux a -t joe || tmux new -s joe || bash'
372-
$ exec_secure=1 scw exec myserver bash
372+
$ SCW_SECURE_EXEC=1 scw exec myserver bash
373373
$ scw exec -w $(scw start $(scw create ubuntu-trusty)) bash
374374
$ scw exec $(scw start -w $(scw create ubuntu-trusty)) bash
375375
$ scw exec myserver tmux new -d sleep 10
@@ -1183,6 +1183,8 @@ $ scw inspect myserver | jq '.[0].public_ip.address'
11831183

11841184
### master (unreleased)
11851185

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

11881190
View full [commits list](https://github.com/scaleway/scaleway-cli/compare/v1.8.0...master)

pkg/cli/cmd_exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var cmdExec = &Command{
1616
$ scw exec myserver bash
1717
$ scw exec --gateway=myotherserver myserver bash
1818
$ scw exec myserver 'tmux a -t joe || tmux new -s joe || bash'
19-
$ exec_secure=1 scw exec myserver bash
19+
$ SCW_SECURE_EXEC=1 scw exec myserver bash
2020
$ scw exec -w $(scw start $(scw create ubuntu-trusty)) bash
2121
$ scw exec $(scw start -w $(scw create ubuntu-trusty)) bash
2222
$ scw exec myserver tmux new -d sleep 10

pkg/cli/main.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,6 @@ func Start(rawArgs []string, streams *commands.Streams) (int, error) {
5050
return 1, fmt.Errorf("unable to open .scwrc config file: %v", cfgErr)
5151
}
5252

53-
if config != nil {
54-
defaultComputeAPI := os.Getenv("scaleway_api_endpoint")
55-
if defaultComputeAPI == "" {
56-
defaultComputeAPI = config.ComputeAPI
57-
}
58-
}
59-
6053
if *flVersion {
6154
fmt.Fprintf(streams.Stderr, "scw version %s, build %s\n", scwversion.VERSION, scwversion.GITCOMMIT)
6255
return 0, nil

pkg/commands/info.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111

1212
"github.com/kardianos/osext"
1313

14+
"github.com/scaleway/scaleway-cli/pkg/api"
1415
"github.com/scaleway/scaleway-cli/pkg/config"
1516
)
1617

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

2627
fmt.Fprintf(ctx.Stdout, "Organization:\t\t%s\n", ctx.API.Organization)
2728
// FIXME: add partially-masked token
28-
fmt.Fprintf(ctx.Stdout, "API Endpoint:\t\t%s\n", ctx.Getenv("scaleway_api_endpoint"))
29+
fmt.Fprintf(ctx.Stdout, "API Endpoint:\t\t%s\n", api.ComputeAPI)
2930
configPath, _ := config.GetConfigFilePath()
3031
fmt.Fprintf(ctx.Stdout, "RC file:\t\t%s\n", configPath)
3132
fmt.Fprintf(ctx.Stdout, "User:\t\t\t%s\n", ctx.Getenv("USER"))

pkg/config/config.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ func GetConfig() (*Config, error) {
8383
config.AccountAPI = "https://account.scaleway.com"
8484
config.Save()
8585
}
86-
if os.Getenv("scaleway_api_endpoint") == "" {
87-
os.Setenv("scaleway_api_endpoint", config.ComputeAPI)
88-
}
8986
return &config, nil
9087
}
9188

pkg/utils/utils.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func SSHExec(publicIPAddress string, privateIPAddress string, command []string,
7979
// NewSSHExecCmd computes execve compatible arguments to run a command via ssh
8080
func NewSSHExecCmd(publicIPAddress string, privateIPAddress string, allocateTTY bool, command []string, gatewayIPAddress string) *sshcommand.Command {
8181
quiet := os.Getenv("DEBUG") != "1"
82-
secureExec := os.Getenv("exec_secure") == "1"
82+
secureExec := os.Getenv("SCW_SECURE_EXEC") == "1"
8383
sshCommand := &sshcommand.Command{
8484
AllocateTTY: true,
8585
Command: command,

0 commit comments

Comments
 (0)