config

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AwsAccessKeyIdSuffix     = "AWS_ACCESS_KEY_ID"
	AwsSecretAccessKeySuffix = "AWS_SECRET_ACCESS_KEY"
)
View Source
const (
	ServerApiKeyEnv = "SERVER_API_KEY"
	DefaultTsState  = "/var/lib/texit/tsstate"
)
View Source
const (
	TailnetApiKeySuffix = "TAILNET_API_KEY"
)

Variables

View Source
var (
	ErrMissingDatabaseHost = errors.New("missing database host")
	ErrMissingDatabasePort = errors.New("missing database port")
	ErrMissingDatabaseUser = errors.New("missing database user")
	ErrMissingDatabasePass = errors.New("missing database pass")
	ErrMissingDatabaseName = errors.New("missing database name")
)
View Source
var (
	ErrMissingProviderAwsAccessKey = fmt.Errorf("missing provider access key")
	ErrMissingProviderAwsSecretKey = fmt.Errorf("missing provider secret key")
	ErrMissingProviderName         = fmt.Errorf("missing provider name")
)
View Source
var (
	ErrMissingTailnetType            = errors.New("missing tailnet type")
	ErrMissingTailnet                = errors.New("missing tailnet")
	ErrMissingTailnetApiKey          = errors.New("missing tailnet api key")
	ErrMissingUser                   = errors.New("missing headscale user")
	ErrMissingHeadscaleControlServer = errors.New("missing headscale control server")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	Server    *ServerConfig     `yaml:"server"`
	Tailnets  []*TailnetConfig  `yaml:"tailnets"`
	Database  *DatabaseConfig   `yaml:"database"`
	Providers []*ProviderConfig `yaml:"providers"`
}

func LoadFromFile

func LoadFromFile(path string) (*Config, error)

Loads the application config from a file at the specified path.

type DatabaseConfig

type DatabaseConfig struct {
	// The database engine to use
	Engine DatabaseEngine `yaml:"engine"`
	// The host of the database
	Host string `yaml:"host"`
	// The port of the database
	Port int `yaml:"port"`
	// The username to connect to the database
	Username string `yaml:"username"`
	// The password to connect to the database
	Password string `yaml:"password"`
	// The name of the database
	Database string `yaml:"database"`
	// Location of the database file. For sqlite only
	Location string `yaml:"location"`
}

Configuration for the database

func (*DatabaseConfig) Validate

func (c *DatabaseConfig) Validate() error

type DatabaseEngine

type DatabaseEngine string
const (
	DatabaseEngineSqlite DatabaseEngine = "sqlite"
)

type ProviderConfig

type ProviderConfig struct {
	// The type of provider, curretly only aws-ecs
	Type ProviderType `yaml:"type"`
	// The access key for the provider. This is only for AWS types.
	AccessKey string `yaml:"accessKey"`
	// The secret key for the provider. This is only for AWS types.
	SecretKey string `yaml:"secretKey"`
	// The name of the provider.
	Name string `yaml:"name"`
}

Configuration for a provider. Currently only AWS ECS.

func (*ProviderConfig) Validate

func (c *ProviderConfig) Validate() error

type ProviderType

type ProviderType string
const (
	ProviderTypeAwsEcs ProviderType = "aws-ecs"
	ProviderTypeAwsEc2 ProviderType = "aws-ec2"
)

func (ProviderType) String

func (t ProviderType) String() string

type ServerConfig

type ServerConfig struct {
	// The address to listen on
	Address string `yaml:"address"`
	// If specified, the server will join the tailnet with the config provided
	Tailnet *tsn.Config `yaml:"tailnet"`
	// A static key to use for the API. If not specified, one will be generated.
	APIKey string `yaml:"apiKey"` //TODO: make this better one day
}

Configuration for the server

func (*ServerConfig) Validate

func (c *ServerConfig) Validate() error

type TailnetConfig

type TailnetConfig struct {
	// The type of tailnet, tailscale or headscale
	Type TailnetType `yaml:"type"`
	// The network of the tailnet. On tailscale this is the network id
	Tailnet string `yaml:"tailnet"`
	// The api token to communicate with the tailnet
	ApiKey string `yaml:"apiKey"`
	// The user to register exist nodes for.
	User string `yaml:"user"`
	// the control server to use. This is require for headscale
	ControlServer string `yaml:"controlServer"`
}

Configuration for the tailnet exit nodes will join

func (*TailnetConfig) Validate

func (c *TailnetConfig) Validate() error

type TailnetType

type TailnetType string // tailscale or headscale
const (
	TailnetTypeTailscale TailnetType = "tailscale"
	TailnetTypeHeadscale TailnetType = "headscale"
)

func (TailnetType) String

func (t TailnetType) String() string

Jump to

Keyboard shortcuts

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