lavamoat-core
Version:
LavaMoat kernel and utils
46 lines • 1.81 kB
TypeScript
export type PolicyOpts = {
debugMode: boolean;
policyPath: string;
};
/**
* Loads a policy from disk, returning a default empty policy if not found.
*
* @param {PolicyOpts} opts
* @returns {Promise<import('./schema').LavaMoatPolicy>}
* @todo Because there is no validation taking place, the resulting value could
* be literally anything `JSON.parse()` could return. Also note that this
* returns a `LavaMoatPolicy` when we could be asking for a
* `LavaMoatPolicyOverrides`; make your type assertions accordingly!
*/
export function loadPolicy({ debugMode, policyPath }: PolicyOpts): Promise<import("./schema").LavaMoatPolicy>;
/**
* Loads policy and policy overrides from disk and merges them.
*
* If overrides exist, writes the overrides _back_ into the policy file.
*
* @param {PolicyOpts & { policyOverridePath: string }} opts
* @returns {Promise<import('./schema').LavaMoatPolicy>}
*/
export function loadPolicyAndApplyOverrides({ debugMode, policyPath, policyOverridePath, }: PolicyOpts & {
policyOverridePath: string;
}): Promise<import("./schema").LavaMoatPolicy>;
/**
* Loads policy and policy overrides from disk and merges them.
*
* Doesn't write anything back to disk.
*
* @param {PolicyOpts & { policyOverridePath: string }} opts
* @returns {{
* policy: import('./schema').LavaMoatPolicy | undefined
* applyOverride: (
* main: import('./schema').LavaMoatPolicy
* ) => import('./schema').LavaMoatPolicy
* }}
*/
export function loadPoliciesSync({ debugMode, policyPath, policyOverridePath }: PolicyOpts & {
policyOverridePath: string;
}): {
policy: import("./schema").LavaMoatPolicy | undefined;
applyOverride: (main: import("./schema").LavaMoatPolicy) => import("./schema").LavaMoatPolicy;
};
//# sourceMappingURL=loadPolicy.d.ts.map