config

package
v1.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// RootDir contains the name of the directory where gebug internals files and configurations are stored
	RootDir = ".gebug"

	// Path contains the name of gebug's configuration file
	Path = "config.yaml"

	// DockerfileName contains the name of the dockerfile that is used for building and running the project
	DockerfileName = "Dockerfile"

	// DockerComposeFileName contains the name of the docker-compose configuration that is used to configure the container
	DockerComposeFileName = "docker-compose.yml"
)

Variables

View Source
var AppFs = afero.NewOsFs()

AppFs hold the file-system abstraction for this package

Functions

func FilePath

func FilePath(workDir string, fileName string) string

FilePath returns the path of a file inside gebug's directory

func ResolvePath added in v0.0.3

func ResolvePath(projectPath string) string

ResolvePath of the project while taking care valid suffixes like '/', '.gebug' etc.

Types

type Config

type Config struct {
	Name             string   `yaml:"name" json:"name"`
	OutputBinaryPath string   `yaml:"output_binary" json:"outputBinary"`
	PreRunCommands   []string `yaml:"pre_run_commands,omitempty" json:"preRunCommands"`
	BuildCommand     string   `yaml:"build_command" json:"buildCommand"`
	BuildDir         string   `yaml:"build_dir" json:"buildDir"`
	RunCommand       string   `yaml:"run_command" json:"runCommand"`
	RuntimeImage     string   `yaml:"runtime_image" json:"runtimeImage"`
	DebuggerEnabled  bool     `yaml:"debugger_enabled" json:"debuggerEnabled"`
	DebuggerPort     int      `yaml:"debugger_port" json:"debuggerPort"`
	ExposePorts      []string `yaml:"expose_ports" json:"exposePorts"`
	Networks         []string `yaml:"networks" json:"networks"`
	Environment      []string `yaml:"environment" json:"environment"`
}

Config contains the fields of gebug configuration

func Load

func Load(input []byte) (*Config, error)

Load loads a configuration to a Config struct

func (*Config) Generate

func (c *Config) Generate(workDir string) error

Generate generates the required files to run the docker

func (*Config) RenderDockerComposeFile

func (c *Config) RenderDockerComposeFile(writer io.Writer) error

RenderDockerComposeFile writes the docker-compose.yml configuration to writer

func (*Config) RenderDockerfile

func (c *Config) RenderDockerfile(writer io.Writer) error

RenderDockerfile writes the Dockerfile to writer

func (Config) Write

func (c Config) Write(writer io.Writer) error

Write the serialized configuration

Jump to

Keyboard shortcuts

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