2024-09-12 00:03:29 +02:00
|
|
|
|
|
|
|
namespace _zeitbild.conf
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
2024-09-18 18:17:25 +02:00
|
|
|
const _schema : lib_plankton.conf.type_schema = {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"version": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "integer",
|
|
|
|
"enum": [1]
|
|
|
|
},
|
|
|
|
"log": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "array",
|
|
|
|
"items": {
|
|
|
|
"anyOf": [
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"kind": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string",
|
|
|
|
"enum": ["stdout"]
|
|
|
|
},
|
|
|
|
"data": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"threshold": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string",
|
|
|
|
"enum": [
|
|
|
|
"debug",
|
|
|
|
"info",
|
|
|
|
"notice",
|
|
|
|
"warning",
|
|
|
|
"error"
|
|
|
|
],
|
|
|
|
"default": "info"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"default": [
|
|
|
|
{
|
|
|
|
"kind": "stdout",
|
|
|
|
"data": {
|
|
|
|
"threshold": "info"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
},
|
|
|
|
"server": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"address": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string",
|
|
|
|
"default": "::"
|
|
|
|
},
|
|
|
|
"port": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "integer",
|
|
|
|
"default": 7845
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
],
|
|
|
|
"additionalProperties": false,
|
|
|
|
"default": {
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"database": {
|
|
|
|
"anyOf": [
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"kind": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string",
|
|
|
|
"enum": ["sqlite"]
|
|
|
|
},
|
|
|
|
"data": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"path": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string",
|
|
|
|
"default": "data.sqlite"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
],
|
|
|
|
"default": {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"kind"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"kind": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string",
|
|
|
|
"enum": ["postgresql"]
|
|
|
|
},
|
|
|
|
"data": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"host": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"port": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "integer",
|
|
|
|
"default": 5432
|
|
|
|
},
|
|
|
|
"username": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"password": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string"
|
|
|
|
},
|
|
|
|
"scheme": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "string"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"host",
|
|
|
|
"username",
|
|
|
|
"password",
|
|
|
|
"scheme"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"kind",
|
|
|
|
"data"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"default": {
|
|
|
|
"kind": "sqlite"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"session_management": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
|
|
"in_memory": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "boolean",
|
|
|
|
"default": true
|
|
|
|
},
|
|
|
|
"drop_all_at_start": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "boolean",
|
|
|
|
"default": true
|
|
|
|
},
|
|
|
|
"lifetime": {
|
|
|
|
"nullable": false,
|
|
|
|
"type": "integer",
|
|
|
|
"default": 900
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
],
|
|
|
|
"additionalProperties": false,
|
|
|
|
"default": {}
|
2024-09-12 00:03:29 +02:00
|
|
|
}
|
2024-09-18 18:17:25 +02:00
|
|
|
},
|
|
|
|
"required": [
|
|
|
|
"version"
|
|
|
|
],
|
|
|
|
"additionalProperties": false
|
2024-09-12 00:03:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
2024-09-18 18:17:25 +02:00
|
|
|
var _data : (null | any) = null;
|
2024-09-12 00:03:29 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
2024-09-18 18:17:25 +02:00
|
|
|
export function schema(
|
|
|
|
) : lib_plankton.conf.type_schema
|
2024-09-12 00:03:29 +02:00
|
|
|
{
|
2024-09-18 18:17:25 +02:00
|
|
|
return _schema;
|
2024-09-12 00:03:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
2024-09-18 18:17:25 +02:00
|
|
|
export function get(
|
|
|
|
) : any
|
2024-09-12 00:03:29 +02:00
|
|
|
{
|
2024-09-18 18:17:25 +02:00
|
|
|
if (_data === null) {
|
|
|
|
throw (new Error("conf not loaded yet"));
|
2024-09-12 00:03:29 +02:00
|
|
|
}
|
|
|
|
else {
|
2024-09-18 18:17:25 +02:00
|
|
|
return _data;
|
2024-09-12 00:03:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*/
|
2024-09-18 18:17:25 +02:00
|
|
|
export async function init(
|
|
|
|
path : string
|
|
|
|
) : Promise<void>
|
2024-09-12 00:03:29 +02:00
|
|
|
{
|
2024-09-18 18:17:25 +02:00
|
|
|
_data = await lib_plankton.conf.load(
|
|
|
|
_schema,
|
|
|
|
path
|
|
|
|
);
|
|
|
|
return Promise.resolve<void>(undefined);
|
2024-09-12 00:03:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|