1.9 KiB
weatherapi CLI
Shortest Useful Command
go run ./cmd/weatherapi -config config.yml
This starts the HTTP API with the supplied YAML configuration. The configured
Postgres database must be reachable, and templates.base_dir must point to the
text response templates when text output is used.
Command Overview
weatherapi is the service executable in cmd/weatherapi. It loads
configuration, opens configured database handles, selects the first configured
database as the primary weather data store, registers HTTP endpoints, and starts
the feedapi HTTP runtime.
Build and run a local binary:
go build -o ./weatherapi ./cmd/weatherapi
./weatherapi -config config.yml
Run with the default config path:
./weatherapi
Flag Reference
| Flag | Default | Description |
|---|---|---|
-config |
WEATHERAPI_CONFIG when set, otherwise config.yml |
Path to the YAML config file. |
weatherapi does not currently expose other CLI flags.
Environment Variables
| Variable | Description |
|---|---|
WEATHERAPI_CONFIG |
Default config path used when -config is not provided and the value is not blank. |
Command-line flags take precedence over environment defaults.
Config Path Precedence
-config /path/to/config.yml- non-blank
WEATHERAPI_CONFIG config.ymlin the current working directory
Startup and Shutdown
Startup fails if configuration cannot be loaded, no database is configured, a configured database cannot be opened, the primary database cannot be selected, or the HTTP app cannot be constructed.
The process listens for SIGINT and SIGTERM. When a signal is received, the
runtime context is canceled and feedapi performs graceful HTTP shutdown. Database
close errors during shutdown are logged.
Related Docs
docs/config.md: YAML configuration referencedocs/api.md: public HTTP API reference