Skip to content
Merged
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: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ curl -L https://zerops.io/zcli/install.sh | sh

- Clone this repository
- `cd zcli` into the root of the cloned repository and run `nix develop`.
- Run `nix build` to build the binary / execuetable of zCli.
- zCLI's binary / execuetable will be present in `./result/bin/zcli`.
- Run `nix build` to build the binary / executable of zCLI.
- zCLI's binary / executable will be present in `./result/bin/zcli`.

Currently, the zCLI is distributed for Linux (x86 & x64 architecture), macOS (x64 & M1 architecture) and Windows (x64 architecture).

Expand Down
2 changes: 1 addition & 1 deletion install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ if (!(";${Path};".ToLower() -like "*;${BinDir};*".ToLower())) {
}

Write-Output ""
Write-Output "ZCli was installed successfully to ${ZcliExe}"
Write-Output "zCLI was installed successfully to ${ZcliExe}"
Write-Output "Run 'zcli --help' to get started"
Write-Output "Stuck? Join our Discord https://discord.com/invite/WDvCZ54"
11 changes: 10 additions & 1 deletion src/cmdBuilder/createRunFunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import (

"github.com/pkg/errors"
"github.com/spf13/cobra"

"github.com/zeropsio/zcli/src/cliStorage"
"github.com/zeropsio/zcli/src/constants"
"github.com/zeropsio/zcli/src/entity"
"github.com/zeropsio/zcli/src/flagParams"
"github.com/zeropsio/zcli/src/i18n"
Expand Down Expand Up @@ -86,6 +88,9 @@ func createCmdRunFunc(
storedData := cliStorage.Data()

token := storedData.Token
if token == "" {
token = os.Getenv(constants.CliTokenEnvVar)
}
if token == "" {
if cmd.guestRunFunc != nil {
return cmd.guestRunFunc(ctx, guestCmdData)
Expand All @@ -103,7 +108,11 @@ func createCmdRunFunc(
VpnKeys: storedData.VpnKeys,
}

cmdData.RestApiClient = zeropsRestApiClient.NewAuthorizedClient(token, "https://"+storedData.RegionData.Address)
host := storedData.RegionData.Address
if host == "" {
host = constants.DefaultRegion
}
cmdData.RestApiClient = zeropsRestApiClient.NewAuthorizedClient(token, "https://"+host)

if cmd.scopeLevel != nil {
if err := cmd.scopeLevel.LoadSelectedScope(ctx, cmd, cmdData); err != nil {
Expand Down
2 changes: 2 additions & 0 deletions src/constants/zerops.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (

const (
DefaultRegionUrl = "https://api.app-prg1.zerops.io/api/rest/public/region/zcli"
DefaultRegion = "api.app-prg1.zerops.io"
ZeropsDir = "zerops"
ZeropsLogFile = "zerops.log"
WgConfigFile = "zerops.conf"
Expand All @@ -24,6 +25,7 @@ const (
CliLogFilePathEnvVar = "ZEROPS_CLI_LOG_FILE_PATH"
CliWgConfigPathEnvVar = "ZEROPS_WG_CONFIG_FILE_PATH"
CliTerminalMode = "ZEROPS_CLI_TERMINAL_MODE"
CliTokenEnvVar = "ZEROPS_TOKEN" //nolint:gosec
)

type pathReceiver func(fileMode os.FileMode) (path string, err error)
Expand Down
14 changes: 11 additions & 3 deletions src/i18n/en.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,21 @@ import "fmt"

var en = map[string]string{
// root
GuestWelcome: `Welcome to zCli by Zerops!
GuestWelcome: `Welcome to zCLI by Zerops!

To unlock the full potential of zCLI, you need to log in using your Zerops account.
Logging in enables you to access various features and interact with Zerops services seamlessly.

To log in, simply use the following command: zcli login <your_token>
To log in, use the login command with your authentication token:
zcli login <your_token>

Alternatively, you can use the ZEROPS_TOKEN environment variable to authenticate:
export ZEROPS_TOKEN="<your_token>"

Note: The stored authentication data created by the login command takes precedence over the environment variable if both are present.

Replace <your_token> with the authentication token generated from your Zerops account.

Once logged in, you'll be able to manage projects, deploy applications, configure VPN,
and much more directly from the command line interface.

Expand All @@ -22,7 +30,7 @@ and your %s.`,

// env
GlobalEnvVariables: "Global Env Variables:",
CurrentlyUsedEnvVariables: "Curently used variables:",
CurrentlyUsedEnvVariables: "Currently used variables:",

// login
CmdHelpLogin: "Help for the login command.",
Expand Down