Skip to Content
API

API reference

const configorama = require('configorama')
APIReturnsPurpose
configorama(file, settings)Promise of objectResolve a config.
configorama.sync(file, settings)objectResolve synchronously.
configorama.inspect(file, settings)Promise of object or stringIntrospect without resolving. Full { requirements, graph, audit } model, or one slice via settings.view.
configorama.formatobjectParser utilities for YAML, JSON/JSON5, TOML, INI, HCL, and Markdown frontmatter.

inspect is the unified pre-resolution entry point. Pass settings.view as requirements, audit, or graph for a single slice.

inspect.js
const model = await configorama.inspect('config.yml', { safeMode: true }) console.log(model.audit.summary, model.requirements.summary) const audit = await configorama.inspect('config.yml', { view: 'audit', safeMode: true })

With no view, inspect returns all three projections:

{ schemaVersion: 1, config: 'config.yml', requirements: {}, graph: {}, audit: {} }

Use returnMetadata: true on the main resolver when you need resolved config plus variable and file-reference metadata:

metadata.js
const result = await configorama('serverless.yml', { returnMetadata: true, allowUnknownVariableTypes: true, allowUnresolvedVariables: true, options: { stage: 'prod' } }) console.log(result.config) console.log(result.metadata.variables) console.log(result.metadata.uniqueVariables) console.log(result.metadata.fileDependencies.resolvedPaths)

Compatibility helpers still exist for older consumers: analyze, introspect, audit, graph, buildVariableSyntax, and the Configorama class. New code should start with configorama, configorama.sync, or configorama.inspect.

Use buildVariableSyntax(...) with the syntax setting when ${...} conflicts with another platform:

const { buildVariableSyntax } = configorama const config = await configorama('config.yml', { syntax: buildVariableSyntax('<<', '>>') })

Settings include options, configDir, syntax, variableSources, filters, functions, returnMetadata, safeMode, allowedFileRoots, view (for inspect), and legacy compatibility flags. Read bring your own syntax, security policies, and requirements schema.

Last updated on