Gateway
The gateway namespace mirrors the gateway CLI command:
report the gateway’s global state, and reconcile services to rebuild every nginx
config.
Status
Section titled “Status”Report the gateway’s global state plus every running service routed through the
gateway, across all projects. This is the same set of services that configure
renders into nginx:
const status = await denvig.gateway.status()
console.log(status.handler) // 'nginx'console.log(status.nginx.running) // booleanconsole.log(status.configsPath) // the nginx servers directoryconsole.log(status.nginxConf) // the main nginx.conf denvig generates
for (const svc of status.services) { console.log(svc.projectSlug, svc.name, svc.domain, svc.cnames, svc.port) console.log(svc.secure, svc.certStatus, svc.certDir) console.log(svc.nginxConfigPath) // ~/.denvig/nginx.conf, shared by every service console.log(svc.nginxConfigExists) // whether its server block is in that file}Configure
Section titled “Configure”Reconcile services and rebuild every nginx config from runtime state:
const { reconcile, gateway } = await denvig.gateway.configure()
console.log(gateway.success)console.log(gateway.removed) // configs removed during reconcileconsole.log(gateway.nginxReload) // whether nginx was reloaded
for (const svc of gateway.services) { console.log(svc.serviceName, svc.domain, svc.certStatus, svc.configStatus)}Each configured service reports its domain, CNAMEs, resolved port, certificate
status (valid / missing / not_configured), and whether its config was
written successfully.