cfg

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: GPL-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Name  string `toml:"name" comment:"Name of the application"`
	Build Build  `toml:"Build"`
}

App stores an application configuration.

func AppFromFile

func AppFromFile(path string) (*App, error)

AppFromFile reads a application configuration file and returns it. If the buildCmd is not set in the App configuration it's set to defaultBuild.Command

func ExampleApp

func ExampleApp(name string) *App

ExampleApp returns an exemplary app cfg struct with the name set to the given value

func (*App) ToFile

func (a *App) ToFile(filepath string) error

ToFile writes an exemplary Application configuration file to filepath. The name setting is set to appName

func (*App) Validate

func (a *App) Validate() error

Validate validates a App configuration

type Build

type Build struct {
	Command  string      `toml:"command" commented:"false" comment:"Command to build the application, valid variables: $ROOT, $APPNAME"`
	Includes []string    `toml:"includes" comment:"Repository relative paths to baur include files that the build inherits.\n Valid variables: $ROOT"`
	Input    BuildInput  `comment:"Specification of build inputs like source files, Makefiles, etc"`
	Output   BuildOutput `comment:"Specification of build outputs produced by the [Build.command]"`
}

Build the build section

func (*Build) Validate

func (b *Build) Validate() error

Validate validates the build section

type BuildInput

type BuildInput struct {
	Files         FileInputs    `comment:"Inputs specified by file glob paths"`
	GitFiles      GitFileInputs `comment:"Inputs specified by path, matching only Git tracked files"`
	GolangSources GolangSources `comment:"Inputs specified by directories containing Golang applications"`
}

BuildInput contains information about build inputs

func (*BuildInput) Validate

func (b *BuildInput) Validate() error

Validate validates the BuildInput section

type BuildOutput

type BuildOutput struct {
	DockerImage []*DockerImageOutput `comment:"Docker images that are produced by the [Build.command]"`
	File        []*FileOutput        `comment:"Files that are produces by the [Build.command]"`
}

BuildOutput the build output section

func (*BuildOutput) Validate

func (b *BuildOutput) Validate() error

Validate validates the BuildOutput section

type Database

type Database struct {
	PGSQLURL string `` /* 164-byte string literal not displayed */
}

Database contains database configuration

type Discover

type Discover struct {
	Dirs        []string `toml:"application_dirs" comment:"List of directories containing applications, example: ['go/code', 'shop/']"`
	SearchDepth int      `toml:"search_depth" comment:"Descend at most SearchDepth levels to find application configs"`
}

Discover stores the Discover section of the repository configuration.

func (*Discover) Validate

func (d *Discover) Validate() error

Validate validates the Discover section and sets defaults.

type DockerImageOutput

type DockerImageOutput struct {
	IDFile         string                    `` /* 190-byte string literal not displayed */
	RegistryUpload DockerImageRegistryUpload `comment:"Registry repository the image is uploaded to"`
}

DockerImageOutput describes where a docker container is uploaded to

func (*DockerImageOutput) IsEmpty

func (d *DockerImageOutput) IsEmpty() bool

IsEmpty returns true if DockerImageOutput is empty

func (*DockerImageOutput) Validate

func (d *DockerImageOutput) Validate() error

Validate validates its content

type DockerImageRegistryUpload

type DockerImageRegistryUpload struct {
	Registry   string `` /* 141-byte string literal not displayed */
	Repository string `` /* 141-byte string literal not displayed */
	Tag        string `toml:"tag" comment:"Tag that is applied to the image, valid variables: $APPNAME, $UUID, $GITCOMMIT" commented:"true"`
}

DockerImageRegistryUpload holds information about where the docker image should be uploaded to

func (*DockerImageRegistryUpload) IsEmpty

func (d *DockerImageRegistryUpload) IsEmpty() bool

IsEmpty returns true if the struct is empty

func (*DockerImageRegistryUpload) Validate

func (d *DockerImageRegistryUpload) Validate() error

Validate validates its content

type FileCopy added in v0.11.1

type FileCopy struct {
	Path string `toml:"path" comment:"Destination directory" commented:"true"`
}

FileCopy describes where a file artifact should be copied to

func (*FileCopy) IsEmpty added in v0.11.1

func (f *FileCopy) IsEmpty() bool

IsEmpty returns true if FileCopy is empty

type FileInputs

type FileInputs struct {
	Paths []string `` /* 209-byte string literal not displayed */
}

FileInputs describes a file source

func (*FileInputs) Validate

func (f *FileInputs) Validate() error

Validate validates a [[Sources.Files]] section

type FileOutput

type FileOutput struct {
	Path     string   `toml:"path" comment:"Path relative to the application directory, valid variables: $APPNAME" commented:"true"`
	FileCopy FileCopy `comment:"Copy the file to a local directory"`
	S3Upload S3Upload `comment:"Upload the file to S3"`
}

FileOutput describes where a file artifact should be uploaded to

func (*FileOutput) IsEmpty

func (f *FileOutput) IsEmpty() bool

IsEmpty returns true if FileOutput is empty

func (*FileOutput) Validate

func (f *FileOutput) Validate() error

Validate validates a [[Build.Output.File]] section

type GitFileInputs

type GitFileInputs struct {
	Paths []string `` /* 233-byte string literal not displayed */
}

GitFileInputs describes source files that are in the git repository by git pathnames

type GolangSources

type GolangSources struct {
	Environment []string `` /* 268-byte string literal not displayed */
	Paths       []string `` /* 215-byte string literal not displayed */
}

GolangSources specifies inputs for Golang Applications

func (*GolangSources) Validate

func (g *GolangSources) Validate() error

Validate validates the GolangSources section

type Include added in v0.16.0

type Include struct {
	BuildInput  BuildInput
	BuildOutput BuildOutput
}

Include represents an include configuration file.

func ExampleInclude added in v0.16.0

func ExampleInclude() *Include

ExampleInclude returns an Include struct with exemplary values.

func IncludeFromFile added in v0.16.0

func IncludeFromFile(path string) (*Include, error)

IncludeFromFile deserializes an Include struct from a file.

func (*Include) IncludeToFile added in v0.16.0

func (in *Include) IncludeToFile(filepath string) error

IncludeToFile serializes the Include struct to TOML and writes it to filepath.

func (*Include) Validate added in v0.16.0

func (in *Include) Validate() error

Validate validates an Include configuration struct.

type Repository

type Repository struct {
	ConfigVersion int      `toml:"config_version" comment:"Version of baur configuration format"`
	Database      Database `toml:"Database"`
	Discover      Discover `comment:"Application discovery settings"`
}

Repository contains the repository configuration.

func ExampleRepository

func ExampleRepository() *Repository

ExampleRepository returns an exemplary Repository config

func RepositoryFromFile

func RepositoryFromFile(cfgPath string) (*Repository, error)

RepositoryFromFile reads the repository config from a file and returns it.

func (*Repository) ToFile

func (r *Repository) ToFile(filepath string, overwrite bool) error

ToFile writes an Repository configuration file to filepath. If overwrite is true an existent file will be overwriten. If it's false the function returns an error if the file exist.

func (*Repository) Validate

func (r *Repository) Validate() error

Validate validates a repository configuration

type S3Upload

type S3Upload struct {
	Bucket   string `toml:"bucket" comment:"Bucket name, valid variables: $APPNAME" commented:"true"`
	DestFile string `toml:"dest_file" comment:"Remote File Name, valid variables: $APPNAME, $UUID, $GITCOMMIT" commented:"true"`
}

S3Upload contains S3 upload information

func (*S3Upload) IsEmpty

func (s *S3Upload) IsEmpty() bool

IsEmpty returns true if S3Upload is empty

func (*S3Upload) Validate

func (s *S3Upload) Validate() error

Validate validates a [[Build.Output.File]] section

Jump to

Keyboard shortcuts

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