config

package
v0.0.0-...-46b6292 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: Apache-2.0 Imports: 17 Imported by: 5

Documentation

Overview

Package config parse /etc/os-release More about the os-release: https://www.linux.org/docs/man5/os-release.html We parse /etc/os-release, this is done specifically for a use case on Oracle Cloud Cloud Shell where DockerEngine is not available and Docker cli point to podman cli

Index

Constants

View Source
const (
	DefaultProvider = "default"

	ReadWritePerms = os.FileMode(0755)

	CurrentContext      = "current-context"
	ContextProvider     = "provider"
	CurrentCliVersion   = "cli-version"
	ContainerEngineType = "container-enginetype"

	EnvFnRegistry = "registry"
	EnvFnContext  = "context"

	OCI_CLI_AUTH_ENV_VAR                  = "OCI_CLI_AUTH"
	OCI_CLI_CLOUDSHELL_ENV_VAR            = "OCI_CLI_CLOUD_SHELL"
	OCI_CLOUDSHELL_OS_NAME                = "Oracle Linux Server"
	OCI_CLOUDSHELL_OL8_VERSION_IDENTIFIER = "el8"
	DEFAULT_LINUX_OS_RELEASE_FILE_PATH    = "/etc/os-release"
	OCI_CLI_AUTH_INSTANCE_PRINCIPAL       = "instance_principal"
	OCI_CLI_AUTH_INSTANCE_OBO_USER        = "instance_obo_user"
	DefaultContainerEngineType            = "docker"
)

Variables

View Source
var EnvIsOL8CloudShell bool = false
View Source
var Version = "0.6.38"

Version of Fn CLI

Functions

func GetContextsPath

func GetContextsPath() string

GetContextsPath : Returns the path to the contexts directory.

func GetCurrentVersion

func GetCurrentVersion(url string) string

func GetHomeDir

func GetHomeDir() string

func GetLatestVersion

func GetLatestVersion(url string) string

func GetVersion

func GetVersion(versionType string) string

func Init

func Init() error

Init : Initialise/load config direc

func LoadConfiguration

func LoadConfiguration(c *cli.Context) error

func ValidateContainerEngineType

func ValidateContainerEngineType(containerEngineType string) error

func WriteConfigValueToConfigFile

func WriteConfigValueToConfigFile(key, value string) error

func WriteYamlFile

func WriteYamlFile(filename string, values *ContextMap) error

Types

type ContextFile

type ContextFile struct {
	ContextProvider string `yaml:"provider" json:"provider"`
	EnvFnAPIURL     string `yaml:"api-url" json:"apiUrl"`
	EnvFnRegistry   string `yaml:"registry" json:"registry"`
}

ContextFile defines the internal structure of a default context

func NewContextFile

func NewContextFile(filePath string) (*ContextFile, error)

NewContextFile creates a new instance of the context YAML file

type ContextMap

type ContextMap map[string]string

func DecodeYAMLFile

func DecodeYAMLFile(filename string) (*ContextMap, error)

func DefaultContextConfigContents

func DefaultContextConfigContents() (contextMap *ContextMap)

type OSRelease

type OSRelease struct {
	Name       string
	PlatformID string
}

func Parse

func Parse(path string) (*OSRelease, error)

Parse parses the os-release file pointing to by path. The fields are saved into the Release global variable.

type ViperConfigSource

type ViperConfigSource struct {
}

func (*ViperConfigSource) GetBool

func (*ViperConfigSource) GetBool(key string) bool

func (*ViperConfigSource) GetString

func (*ViperConfigSource) GetString(key string) string

func (*ViperConfigSource) IsSet

func (*ViperConfigSource) IsSet(key string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳