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 the gateway-configured services of the
project resolved from the SDK’s cwd:
const status = await denvig.gateway.status()
console.log(status.handler) // 'nginx'console.log(status.nginx.running) // booleanconsole.log(status.configsPath) // where server configs are writtenconsole.log(status.nginxConf) // the generated include file
for (const svc of status.services) { console.log(svc.name, svc.domain, svc.port, svc.secure, svc.certFound)}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.