file-cms
Version:
File based Content Management System, easy to use with content stored in native file system
33 lines (32 loc) • 1.14 kB
JavaScript
import { __assign } from "tslib";
import { NoRootDirSetError } from "./errors/NoRootDirSetError";
import { UnknownFilterProviderError } from "./errors/UnknownFilterProviderError";
import { defaultProviders } from "./internal/filterProviders";
var Config = /** @class */ (function () {
function Config() {
}
Config.setRootDir = function (rootDir) {
this.rootDir = rootDir;
};
Config.getRootDir = function () {
if (typeof this.rootDir == "string") {
return this.rootDir;
}
else if (typeof process.env.FILE_CMS_ROOT_DIR == "string") {
return process.env.FILE_CMS_ROOT_DIR;
}
throw new NoRootDirSetError();
};
Config.setFilterProvider = function (name, provider) {
this.filterProviders[name] = provider;
};
Config.getFilterProvider = function (name) {
if (this.filterProviders[name] === undefined) {
throw new UnknownFilterProviderError(name);
}
return this.filterProviders[name];
};
Config.filterProviders = __assign({}, defaultProviders);
return Config;
}());
export { Config };