config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigExists

func ConfigExists() bool

Checks whether the config file exists.

Wrapper around config.FileExists()

func ConfigFolderExists

func ConfigFolderExists() bool

Checks whether the config folder exists.

Wrapper around config.FileExists()

func FileExists

func FileExists(path string) bool

Checks if a file/path exists. Returns true if it exists

Wrapper around os.Stat() & os.IsNotExists()

func GetCurrentDirectory

func GetCurrentDirectory() string

Gets the current folder's full path.

Throws a fatal error in case of failure and exists the program.

func GetDirNmHash

func GetDirNmHash() string

Returns a hash string made using the current directory's name.

func SetDefaults

func SetDefaults(cfg *Struct)

func SetName

func SetName(cfg *Struct)

func Write

func Write(configs *Struct) error

Types

type Binds

type Binds struct {
	XOrg bool     `default:"true" json:"xorg"`
	Dev  bool     `default:"true" json:"/dev"`
	Vars []string `default:"[]" json:"env-vars"`
}

type Container

type Container struct {
	Name       string   `json:"name"`
	Args       []string `default:"[\"--net=host\"]" json:"arguments"`
	WorkDir    string   `default:"/code" json:"work-dir"`
	Shell      string   `default:"/bin/sh" json:"shell"`
	RootUser   bool     `json:"root-user"`
	Privileged bool     `default:"true" json:"privileged"`
	Binds      Binds    `json:"binds"`
	Ports      []string `default:"[]" json:"ports"`
	Mounts     []string `default:"[]" json:"mounts"`
}

type Image

type Image struct {
	URI        string            `default:"alpine:latest" json:"uri"`
	OnCreation []string          `default:"[\"apk update\"]" json:"on-creation"`
	OnFinish   []string          `default:"[]" json:"on-finish"`
	Installer  Installer         `json:"pkg-manager"`
	EnvVars    map[string]string `default:"{}" json:"env-vars"`
}

type Installer

type Installer struct {
	Operations  Operations        `json:"operations"`
	ArgModifier map[string]string `default:"{}" json:"args-modifier"`
}

type Operations

type Operations struct {
	Add  string `default:"apk add {args}" json:"add"` // add "{-y}" to auto install on creation on debian
	Del  string `default:"apk del {args}" json:"del"`
	Upd  string `default:"apk update {args}" json:"update"`
	Dup  string `default:"apk upgrade {args}" json:"upgrade"`
	Srch string `default:"apk search {args}" json:"search"`
}

type Podman

type Podman struct {
	Path      string    `default:"podman" json:"path"`
	Rootless  bool      `default:"true" json:"rootless"`
	BuildOnly bool      `json:"create-deletion"`
	Container Container `json:"container"`
}

type Struct

type Struct struct {
	Image       Image             `json:"image"`
	Podman      Podman            `json:"podman"`
	Commands    map[string]string `default:"{}" json:"commands"`
	Packages    []string          `default:"[]" json:"packages"`
	DevPackages []string          `default:"[]" json:"devpackages"`
	UserPkgs    UserPkgs          `json:"userpkgs"`
}

func Read

func Read() (Struct, error)

func ReadBytes

func ReadBytes(data []byte) (Struct, error)

type UserPkgs added in v0.2.0

type UserPkgs struct {
	Packages    []string `default:"[]" json:"packages"`
	DevPackages []string `default:"[]" json:"devpackages"`
}

Jump to

Keyboard shortcuts

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