Documentation
¶
Overview ¶
Package app implements the openbanking CLI command dispatch. Commands are methods on App so tests can drive them with injected writers, an explicit config path, and a custom HTTP client.
Index ¶
Constants ¶
const CACertEnv = "OPENBANKING_CA_CERT"
CACertEnv names an optional path to a PEM file holding one or more root CA certificates. When set, the CLI's HTTP client trusts those roots in addition to the system trust store — useful behind a TLS-inspecting proxy or against a staging environment fronted by a private CA. Empty/whitespace is ignored.
Variables ¶
This section is empty.
Functions ¶
func BuildHTTPClient ¶ added in v0.2.10
BuildHTTPClient returns a custom *http.Client when the user has opted in — via a positive timeout or a custom root CA path — and (nil, nil) otherwise, which leaves App.HTTPClient nil so the SDK keeps its default client (unchanged behavior). The returned client carries the request timeout and, when a CA path is given, a transport whose TLS config trusts the extra root(s).
Proxying needs no wiring here: the default transport and the custom one both use http.ProxyFromEnvironment, so HTTPS_PROXY / HTTP_PROXY / NO_PROXY are honored automatically.
Types ¶
type App ¶
type App struct {
Stdin io.Reader
Stdout io.Writer
Stderr io.Writer
ConfigPath string
Version string // set by main from the build-time version
HTTPClient *http.Client // nil uses the SDK default
// contains filtered or unexported fields
}
App carries the I/O and configuration a command needs. The zero value is not usable; main wires real os streams and the default config path, while tests inject buffers and a temp path.
func (*App) Run ¶
Run dispatches a single command invocation. args is everything after the program name. It first strips the global flags (--output, --no-color, --config), resolves the output environment once, then dispatches through the command table so names, aliases, help and completion share one source.