config

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

SPDX-FileCopyrightText: 2024 Paulo Almeida <almeidapaulopt@gmail.com> SPDX-License-Identifier: MIT

SPDX-FileCopyrightText: 2024 Paulo Almeida <almeidapaulopt@gmail.com> SPDX-License-Identifier: MIT

SPDX-FileCopyrightText: 2024 Paulo Almeida <almeidapaulopt@gmail.com> SPDX-License-Identifier: MIT

Index

Constants

View Source
const (
	DockerDefaultName            = "local"
	TailscaleDefaultProviderName = "default"
)

Variables

View Source
var Config *config

Config is a global variable to store configuration.

Functions

func InitializeConfig

func InitializeConfig() error

GetConfig loads, validates and returns configuration.

Types

type DockerTargetProviderConfig

type DockerTargetProviderConfig struct {
	Host                 string `validate:"required,uri" default:"unix:///var/run/docker.sock"`
	TargetHostname       string `validate:"ip|hostname" default:"172.31.0.1"`
	DefaultProxyProvider string `validate:"omitempty" yaml:",omitempty"`
}

DockerTargetProviderConfig struct stores Docker target provider configuration.

type File added in v1.2.0

type File struct {
	// contains filtered or unexported fields
}

func NewFile added in v1.2.0

func NewFile(log zerolog.Logger, filename string, data any) *File

func (*File) Load added in v1.2.0

func (f *File) Load() error

func (*File) OnChange added in v1.2.0

func (f *File) OnChange(run func(in fsnotify.Event))

OnConfigChange sets the event handler that is called when a config file changes.

func (*File) Save added in v1.2.0

func (f *File) Save() error

func (*File) Watch added in v1.2.0

func (f *File) Watch()

WatchConfig starts watching a config file for changes.

type FilesTargetProviderConfig added in v1.1.0

type FilesTargetProviderConfig struct {
	Filename              string `validate:"required,file"`
	DefaultProxyProvider  string `validate:"omitempty" yaml:",omitempty"`
	DefaultProxyAccessLog bool   `default:"true" validate:"boolean"`
}

filesConfig struct stores File target provider configuration.

type HTTPConfig

type HTTPConfig struct {
	Hostname string `validate:"ip|hostname,required" default:"0.0.0.0"`
	Port     uint16 `validate:"numeric,min=1,max=65535,required" default:"8080"`
}

HTTPConfig stores HTTP configuration.

type LogConfig

type LogConfig struct {
	Level string `validate:"required,oneof=debug info warn error fatal panic trace" default:"info"`
	JSON  bool   `validate:"boolean" default:"false"`
}

LogConfig stores logging configuration.

type TailscaleProxyProviderConfig

type TailscaleProxyProviderConfig struct {
	Providers map[string]*TailscaleServerConfig `validate:"dive,required"`
	DataDir   string                            `validate:"dir" default:"/data/"`
}

TailscaleProxyProviderConfig struct stores Tailscale ProxyProvider configuration

type TailscaleServerConfig

type TailscaleServerConfig struct {
	AuthKey     string `default:"" validate:"omitempty" yaml:",omitempty"`
	AuthKeyFile string `default:"" validate:"omitempty" yaml:",omitempty"`
	ControlURL  string `default:"https://controlplane.tailscale.com" validate:"uri"`
}

TailscaleServerConfig struct stores Tailscale Server configuration

Jump to

Keyboard shortcuts

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