Skip to content
Docsv0.7.2

Gateway

The gateway namespace mirrors the gateway CLI command: report the gateway’s global state, and reconcile services to rebuild every nginx config.

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) // boolean
console.log(status.configsPath) // where server configs are written
console.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)
}

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 reconcile
console.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.