config

package
v0.0.0-...-0664273 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupTicliEnv

func SetupTicliEnv() (string, error)

SetupTicliEnv initializes the home directory for the Ticli tool. It determines the home directory path based on the "TICLI_HOME" environment variable, if set, or by using platform-specific defaults (e.g., %LOCALAPPDATA%/ticli on Windows or ~/.ticli on Unix-like systems). The function then creates the home directory, including any necessary parent directories, with specific permissions.

Returns:

string: The absolute path to the created or identified home directory.
error: An error value if any error occurs while determining the home path or creating the directory.
       This includes situations where necessary environment variables are not set or if directory creation fails.

Note: The function will log errors using the log package, providing detailed information on failures.

Usage:

homeDir, err := SetupTicliEnv()
if err != nil {
    log.Println(err)
}

Types

type ConfigStruct

type ConfigStruct struct {
	WorkstationConfig WorkstationConfig `json:"workstation_config"`
	K8sConfigs        []K8sConfig       `json:"k8s_configs"`
	Rules             []Rule            `json:"rules"`
}

func LoadConfig

func LoadConfig() (string, ConfigStruct)

type K8sConfig

type K8sConfig struct {
	Name          string `json:"name"`
	KubeconfigUrl string `json:"kubeconfig_url"`
}

type Rule

type Rule struct {
	Type          string          `json:"type"`
	Specification json.RawMessage `json:"specification"`
}

type TicliContext

type TicliContext struct {
	ConfigOrigin     string
	Config           ConfigStruct
	TicliDir         string
	SelectedPlatform string
}

type WorkstationConfig

type WorkstationConfig struct {
	MinCores  int `json:"min_cores"`
	MinMemory int `json:"min_memory_gb"`
}

Jump to

Keyboard shortcuts

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