config

package
v0.0.0-...-fe5d709 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(hctl hostctl.Controller, cfg *Config) error

func Path

func Path(cfgPath *string) (string, error)

Path returns a path to a config file by checking the following list of options. The first path that points to an existing file is used.

  • localias --config <path> ...
  • LOCALIAS_CONFIGFILE=<path> localias ...
  • .localias.yaml in current directory
  • .localias.yaml in repository root and command is run from inside a repository
  • $XDG_CONFIG_HOME/localias.yaml (or OS fallback if XDG_CONFIG_HOME is not set)

Types

type Config

type Config struct {
	Path    string
	Entries []Entry
}

func Open

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

Open reads and parses a Config struct from a yaml file on disk.

func (Config) CaddyJSON

func (c Config) CaddyJSON() ([]byte, []caddyconfig.Warning, error)

func (Config) CaddyStatePath

func (c Config) CaddyStatePath() string

func (Config) Caddyfile

func (c Config) Caddyfile() string

func (*Config) Clear

func (c *Config) Clear() []Entry

Clear removes all entries from the config.

func (*Config) Remove

func (c *Config) Remove(aliases ...string) []Entry

Remove removes all entries from the config that match any of the specified aliases.

func (*Config) Save

func (c *Config) Save() error

Save writes the config to disk.

func (*Config) Set

func (c *Config) Set(d Entry) bool

Set will add or update the existing list of entries. If there is already a entry with the same upstream/alias, its downstream/port will be updated. If there is not already a entry with the same upstream/alias, the new entry will be added to the list.

Returns `true` if an existing entry was updated, `false` if the entry was added.

type Entry

type Entry struct {
	Alias string
	Port  int
}

func (Entry) Caddyfile

func (entry Entry) Caddyfile() string

func (Entry) Host

func (entry Entry) Host() string

func (Entry) String

func (entry Entry) String() string

Jump to

Keyboard shortcuts

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