spheron

package
v0.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigDir string
View Source
var ConfigName string = "spheron"
View Source
var ConfigPath string
View Source
var ConfigType string = "json"
View Source
var DeploymentEnvironmentId string
View Source
var DeploymentEnvironmentName string
View Source
var DeploymentId string
View Source
var DomainId string
View Source
var EnvCreate = &cobra.Command{
	Use:   "create",
	Short: "Creates an environment variable",
	Long:  `Creates an environment variable`,
	Run: func(cmd *cobra.Command, args []string) {

		projectId := viper.GetString("project")

		if projectId == "" {
			panic("No project selected. Please select a project with `spheronctl set project`")
		}

		deploymentEnvironmentVariables, err := spheron.GetDeploymentEnvironmentVariables(projectId)
		if err != nil {
			panic(err)
		}

		var showingDepEnvs []string

		for _, env := range deploymentEnvironmentVariables {
			showingDepEnvs = append(showingDepEnvs, env.Name)
		}

		envKey := SanitizeInput("Enter the environment variable key: ")
		envValue := SanitizeInput("Enter the environment variable value: ")

		selectedEnvName, err := SanitizeSelectMultiple(showingDepEnvs, "Select Deployment Environment: ", "Do you want to add another Deployment Environment?")

		if err != nil {
			panic(err)
		}

		constructedEnvVariable := spheron.EnvironmentVariables{
			Name:                   envKey,
			Value:                  envValue,
			DeploymentEnvironments: selectedEnvName,
		}
		envsToPush := []spheron.EnvironmentVariables{constructedEnvVariable}

		pushedEnvs, err := spheron.PostEnvironmentVariables(projectId, envsToPush)

		fmt.Println("Pushing the following environment variables to Spheron: ")

		for _, env := range pushedEnvs {
			fmt.Println(env.Name, env.Value, env.ID)
		}

	},
}

EnvCreate is a command to create an environment variable

View Source
var EnvFile string
View Source
var EnvironmentId string
View Source
var Image string
View Source
var Name string
View Source
var ProjectId string
View Source
var Secret string
View Source
var UserEmail string
View Source
var Username string

Functions

func Execute

func Execute()

func FileExists added in v0.2.0

func FileExists(path string) bool

is file exist function, used to look for existing config file

func GetDomainTypeEnum added in v0.3.0

func GetDomainTypeEnum(domainType string) string

a function that switches case for a selected domain type value on the CLI

func GetFileContentType added in v0.5.0

func GetFileContentType(ouput *os.File) (string, error)

func GetFrameworkEnum added in v0.4.0

func GetFrameworkEnum(framework string) string

a function that switches case for a selected framework value on the CLI

func GetNodeEnum added in v0.4.0

func GetNodeEnum(node string) string

a function that switches case for a selected node value on the CLI

func GetProtocolEnum added in v0.3.0

func GetProtocolEnum(protocol string) string

a function that switches case for a selected protocol value on the CLI

func GetProviderEnum added in v0.4.0

func GetProviderEnum(provider string) string

a function that switches case for a selected provider value on the CLI

func ReadLocalConfig added in v0.2.0

func ReadLocalConfig() *spheron.Config

func SanitizeFixedSelect added in v0.2.0

func SanitizeFixedSelect(items []string, prompt string) (string, error)

sanitized fixed select and return selected input as string function

func SanitizeInput added in v0.2.0

func SanitizeInput(query string) string

sanitized input function

func SanitizeInputMultiple added in v0.2.0

func SanitizeInputMultiple(initPrompt string, repeatPrompt string) ([]string, error)

sanitizied input multiple and return inputs as string array function

func SanitizeSelectMultiple added in v0.2.0

func SanitizeSelectMultiple(items []string, initPrompt string, repeatPrompt string) ([]string, error)

sanitized select multiple and return Selected as string array function

func SetSpheronConfigFile added in v0.2.0

func SetSpheronConfigFile()

create config file function

func WriteLocalConfig added in v0.2.0

func WriteLocalConfig()

function to write the configuration in viper memory to the local config file

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL