--- package/config-root.schema.json (excerpt) ---
{
"$schema": "https://json-schema.org/draft-06/schema",
"$id": "https://harper.fast/schema/config-root.schema.json",
"title": "HarperDB Root Configuration",
"description": "JSON Schema for harperdb-config.yaml as documented in docs.html. This focuses on the primary, documented configuration sections and keys. Unknown properties are allowed for forward compatibility.",
"type": "object",
"properties": {
"rootPath": {
"type": "string",
"description": "Root folder where Harper persists data, config, logs, and components. Default: user's home directory"
},
"componentsRoot": {
"type": "string",
"description": "Path to the folder containing local component files. Default: <ROOTPATH>/components"
},
"http": {
"type": "object",
"description": "HTTP server configuration for the main component server.",
"additionalProperties": true,
"properties": {
"sessionAffinity": {
"description": "Route multiple requests from the same client to the same thread. Use 'ip' or a header name.",
"type": ["string", "null"]
},
"compressionThreshold": {
"type": "integer",
"minimum": 0,
"description": "Responses larger than this threshold (bytes) will be compressed for clients that accept compression. Default: 1200"
},
"cors": { "type": "boolean", "description": "Enable Cross Origin Resource Sharing. Default: true" },
"corsAccessList": {
"type": ["array", "null"],
"description": "List of allowed origins for CORS.
--- package/package.json (excerpt) ---
{
"name": "harper",
"description": "Harper is an open-source Node.js performance platform that unifies database, cache, application, and messaging layers into one in-memory process.",
"version": "5.0.28",
"license": "Apache-2.0",
"homepage": "https://harper.fast",
"bugs": {
"url": "https://github.com/harperfast/harper/issues",
"email": "opensource@harperdb.io"
},
"author": {
"name": "HarperDB, Inc.",
"email": "opensource@harperdb.io",
"url": "https://harper.fast"
},
"contributors": [],
"repository": {
"type": "git",
"url": "https://github.com/harperfast/harper.git"
},
"bin": {
"harper": "./dist/bin/harper.js"
},
"files": [
"bin",
"CODE_OF_CONDUCT.md",
"components",
"config",
"config-app.schema.json",
"config-root.schema.json",
"dataLayer",
"dist",
"index.*",
"json",
"launchServiceScripts",
"README.md",
"resources",
"schema.graphql",
"security",
"SECURITY.md",
"server",
"sqlTranslator",
"static",
"studio",
"SUPPORT.md",
"upgrade",
"utility",
"v1.*",
"v2.*",
"validation"
],
"scripts": {
"build": "tsc --project tsconfig.build.json",
"build:watch": "npm run build -- --watch --incremental",
"package": "./build-tools/build.sh",
"lint": "oxlint --deny-warnings .",
"lint:required": "oxlint --quiet .",
"lint:fix": "npm run lint -- --fix",
"format:check": "prettier --check .",
"format:write": "prettier --write .",
"test:integration:api-tests": "node --test integrationTests/apiTests/te
--- package/validation/configValidator.js (excerpt) ---
'use strict';
const fs = require('fs-extra');
const Joi = require('joi');
const os = require('os');
const { boolean, string, number, array } = Joi.types();
const { totalmem } = require('os');
const path = require('path');
const hdbLogger = require('../utility/logging/harper_logger.js');
const hdbUtils = require('../utility/common_utils.js');
const hdbTerms = require('../utility/hdbTerms.ts');
const validator = require('./validationWrapper.js');
const DEFAULT_LOG_FOLDER = 'log';
const DEFAULT_COMPONENTS_FOLDER = 'components';
const INVALID_SIZE_UNIT_MSG = 'Invalid logging.rotation.maxSize unit. Available units are G, M or K';
const INVALID_INTERVAL_UNIT_MSG = 'Invalid logging.rotation.interval unit. Available units are D, H or M (minutes)';
const INVALID_MAX_SIZE_VALUE_MSG =
"Invalid logging.rotation.maxSize value. Value should be a number followed by unit e.g. '10M'";
const INVALID_INTERVAL_VALUE_MSG =
"Invalid logging.rotation.interval value. Value should be a number followed by unit e.g. '10D'";
const UNDEFINED_OPS_API = 'rootPath config parameter is undefined';
const portConstraints = Joi.alternatives([number.min(0), string])
.optional()
.empty(null);
const routeConstraints = Joi.alternatives([
array
.items(
string,
{
host: string.required(),
port: portConstraints,
},
{
hostname: string.required(),
port: portConstraints,
}
)
.empty(null),
array.items(string),
]);
let hdbRoot;
let skipFsVal = false;
module.exports = {
configV