Connect
Point the Admin SDK at a Tenant with a management key.
import { createAdmin } from "@nylorun/admin";
const admin = createAdmin(); // options, environment, then the local Tenant
const deployed = createAdmin({
url: process.env.NYLORUN_RUNTIME_URL!,
key: process.env.NYLORUN_MANAGEMENT_KEY!,
});createAdmin() resolves the URL and the management key once, in this order:
- Explicit
{ url, key }, both or neither NYLORUN_RUNTIME_URLandNYLORUN_MANAGEMENT_KEY- The local Tenant: the project link and the
project-managementkey thatnylorun startwrote
NYLORUN_RUNTIME_URL without NYLORUN_MANAGEMENT_KEY is an app's connection,
so it does not select step 2. admin.source says which step was used
(options, environment, or local-host).
When none resolves, createAdmin() throws connection_missing and lists what
it tried. The first request checks the Runtime's /health and throws
incompatible_host unless it serves protocol 8.
Options
| Option | Type | Purpose |
|---|---|---|
url | string | The Tenant's URL |
key | string | A management key |
tenant | string | The local Tenant to read, instead of the project link's |
cwd | string | Where to look for the project link. Default: the working directory |
Management keys
Only the Tenant's machine issues management keys. No API call creates one.
| Where the Tenant runs | Command |
|---|---|
| Local Tenant | npx nylorun key put <id> --management |
| Self-hosted Runtime container | nylorun-operate keys put <id> --role management |
A management key acts as itself, never for a person. It can issue application keys, but never another management key.