createCnos()
createCnos()
import { createCnos } from '@kitsy/cnos/configure';
const runtime = await createCnos({ workspace: 'api', profile: 'stage',});Common options:
cwdrootworkspaceprofileglobalRootcacheModecacheTtlSecondsprocessEnv
root can be a local path or a remote git root URI:
const runtime = await createCnos({ root: 'git+https://github.com/org/config.git#v2.1.0', workspace: 'travel',});Derived values and runtime namespaces work through the explicit runtime too:
import { createCnos } from '@kitsy/cnos/configure';
const runtime = await createCnos({ cwd: process.cwd(), profile: 'prod',});
runtime.registerRuntimeProvider('request', (key) => { if (key === 'headers.host') { return currentRequest?.headers.host; }
return undefined;});
const origin = runtime.value('app.origin');Workspace selection can come from three places:
- explicit
workspaceincreateCnos({ ... }) - a package-local
.cnosrc.yml - the manifest default workspace
Typical monorepo package anchor:
root: ../../.cnosworkspace: api