env

package
v0.8.7 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

README

ENV module

This module will merge the host env and global env, then render env into cloudrootfs templates or set env when exec a shell command and script.

ENV template render

ENV module only render the filename has ".tmpl" suffix, and render the result into a new file.

Like: test.yaml.tmpl -> test.yaml

test.yaml.tmpl:

{{ .foo }}

render result, test.yaml:

bar

Shell ENV

Add ENV value to each shell command.

Raw shell command:

cat /etc/hosts

WrapperShell:

foo=bar cat /etc/hosts

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertEnv

func ConvertEnv(envList []string) (env map[string]interface{})

ConvertEnv []string to map[string]interface{}, example [IP=127.0.0.1,IP=192.160.0.2,Key=value] will convert to {IP:[127.0.0.1,192.168.0.2],key:value}

Types

type Interface

type Interface interface {
	PreProcessor
	// WrapperShell :If host already set env like DATADISK=/data
	// This function add env to the shell, like:
	// Input shell: cat /etc/hosts
	// Output shell: DATADISK=/data cat /etc/hosts
	// So that you can get env values in you shell script
	WrapperShell(host net.IP, shell string) string
	// RenderAll :render env to all the files in dir
	RenderAll(host net.IP, dir string) error
}

func NewEnvProcessor

func NewEnvProcessor(cluster *v2.Cluster) Interface

type PreProcessor

type PreProcessor interface {
	Process(path string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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