How localias works: Configuration and Proxy
mainLocalias consists of two main components:
- The Configuration File: A YAML file that maps aliases to local ports. This file is the source of truth for which URLs should be redirected and where.
- The Proxy Server: A Caddy-based server that reads the configuration, updates
/etc/hosts, provisions TLS certificates, and proxies incoming requests to the correct local ports.
Configuration File Discovery
Localias searches for a configuration file in the following order, using the first one it finds:
- The path provided via the
--configfile <path>flag. - The path provided via the
LOCALIAS_CONFIGFILE=<path>environment variable. - A
.localias.yamlfile in the current working directory. - A
.localias.yamlfile at the root of the current Git repository. - The default system location:
$XDG_CONFIG_HOME/localias.yaml(on MacOS:~/Library/Application Support/localias.yaml; on Linux/WSL:~/.config/localias.yaml).