Documentation
¶
Overview ¶
Package v1config defines the configuration file and provides functions to read and write it
This is the old version of the config file, which is now deprecated in favor of the new version (v2 at time of writing)
Index ¶
- func Exists() bool
- func FileExists(path string) bool
- func FolderExists() bool
- func GetCurrentDirectory() string
- func GetDirNmHash() string
- func GetPathHash(path string) string
- func SetDefaults(cfg *Struct)
- func SetName(cfg *Struct)
- func Write(configs *Struct) error
- type Binds
- type Container
- type Experiments
- type Image
- type Installer
- type Operations
- type Podman
- type Struct
- type UserPkgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCurrentDirectory ¶
func GetCurrentDirectory() string
GetCurrentDirectory returns the current folder's full path.
func GetDirNmHash ¶
func GetDirNmHash() string
GetDirNmHash returns a hash made using the current directory's name.
func GetPathHash ¶
GetPathHash returns a hash made using the provided path.
func SetDefaults ¶
func SetDefaults(cfg *Struct)
SetDefaults sets the default values for the configuration
Types ¶
type Binds ¶
type Binds struct { // XOrg decides if the X11 socket should be bind mounted XOrg bool `default:"true" json:"xorg"` // Dev decides if the /dev directory should be bind mounted Dev bool `default:"true" json:"/dev"` // Vars is a list of environment variables to copy to the container Vars []string `default:"[]" json:"env-vars"` }
Binds is a list of bind mounts
type Container ¶
type Container struct { // Name of the container Name string `json:"name"` // Args is a list of arguments to pass to the container Args []string `default:"[\"--net=host\"]" json:"arguments"` // WorkDir is the directory where the code will be mounted WorkDir string `default:"/code" json:"work-dir"` // Shell is the shell to use in the container Shell string `default:"/bin/sh" json:"shell"` // RootUser decides if the user inside the container is root or not RootUser bool `json:"root-user"` // Privileged is a boolean that determines if the container should be run in privileged mode. Privileged bool `default:"true" json:"privileged"` // Binds contains settings related to the binds (for example, /dev) Binds Binds `json:"binds"` // Ports is a map of host:container ports Ports []string `default:"[]" json:"ports"` // Mounts is a list of mounts to be added to the container Mounts []string `default:"[]" json:"mounts"` // Experiments contains experimental features Experiments Experiments `json:"experiments"` SharedFolders map[string]interface{} `default:"{}" json:"shared-folders"` }
Container is the struct for the container configuration
type Experiments ¶
type Experiments struct { // Socket decides if the socket server should be started Socket bool `default:"false" json:"sockets"` }
Experiments contains settings for experimental features
type Image ¶
type Image struct { // URI is the location of the image URI string `default:"alpine:latest" json:"uri"` // OnCreation is a list of commands to run on creation OnCreation []string `default:"[\"apk update\"]" json:"on-creation"` // OnFinish is a list of commands to run on finish OnFinish []string `default:"[]" json:"on-finish"` // Installer contains the configuration for the package manager Installer Installer `json:"pkg-manager"` // EnvVars is a list of environment variables to set EnvVars map[string]string `default:"{}" json:"env-vars"` }
Image contains the information for the image
type Installer ¶
type Installer struct { // Operations contains the commands for the package manager Operations Operations `json:"operations"` // ArgModifier lets prefix or suffix packages with a string (see configs/nix/unstable.json) ArgModifier map[string]string `default:"{}" json:"args-modifier"` }
Installer is the configuration for the package manager
type Operations ¶
type Operations struct { // Add is the base string that the package manager uses to add a package Add string `default:"apk add {args}" json:"add"` // add "{-y}" to auto install on creation on debian // Del, short for delete, is the base string that the package manager uses to delete a package Del string `default:"apk del {args}" json:"del"` // Upd, short for update, is the base string that the package manager uses to update the database Upd string `default:"apk update {args}" json:"update"` // Upg, short for upgrade, is the base string that the package manager uses to upgrade all packages Upg string `default:"apk upgrade {args}" json:"upgrade"` // Srch, short for search, is the base string that the package manager uses to search for a package Srch string `default:"apk search {args}" json:"search"` // Clean is the command to clean the cache, necessary if we want to reduce the image size (using the build command) Clean string `default:"rm -rf /var/cache/apk/*" json:"clean"` }
Operations contains all supported commands for managing packages
type Podman ¶
type Podman struct { // Path is the path to the podman executable Path string `default:"podman" json:"path"` // Rootless tells develbox if podman is running as rootless Rootless bool `default:"true" json:"rootless"` // BuildOnly tells develbox if it should delete the container after created BuildOnly bool `json:"create-deletion"` // Container is the container configuration Container Container `json:"container"` }
Podman is the struct for the podman configuration
type Struct ¶
type Struct struct { // Image contains the information for the image Image Image `json:"image"` // Podman contains the configuration for podman Podman Podman `json:"podman"` // Using interface so we can support string and []string Commands map[string]interface{} `default:"{}" json:"commands"` // Packages is a list of packages to install (that are required for your code to work) Packages []string `default:"[]" json:"packages"` // DevPackages is a list of packages to install for development (like compilers, linters, etc) DevPackages []string `default:"[]" json:"devpackages"` // UserPkgs is a list of packages to install user-side (Image has to support it) UserPkgs UserPkgs `json:"userpkgs"` }
Struct is the main configuration struct
type UserPkgs ¶
type UserPkgs struct { // Packages is a list of packages to install Packages []string `default:"[]" json:"packages"` // DevPackages is a list of packages to install for development DevPackages []string `default:"[]" json:"devpackages"` }
UserPkgs is a list of packages to install user-side