Skip to content
Kitsy Docs Open CNOS

createCnos()

createCnos()

import { createCnos } from '@kitsy/cnos/configure';
const runtime = await createCnos({
workspace: 'api',
profile: 'stage',
});

Common options:

  • cwd
  • root
  • workspace
  • profile
  • globalRoot
  • cacheMode
  • cacheTtlSeconds
  • processEnv

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:

  1. explicit workspace in createCnos({ ... })
  2. a package-local .cnosrc.yml
  3. the manifest default workspace

Typical monorepo package anchor:

root: ../../.cnos
workspace: api