96 lines
1.3 KiB
TypeScript
96 lines
1.3 KiB
TypeScript
![]() |
|
||
|
namespace _zeitbild.frontend_web.conf
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
const _schema : lib_plankton.conf.type_schema = {
|
||
|
"nullable": false,
|
||
|
"type": "object",
|
||
|
"properties": {
|
||
|
"version": {
|
||
|
"nullable": false,
|
||
|
"type": "integer",
|
||
|
"enum": [1]
|
||
|
},
|
||
|
"backend": {
|
||
|
"nullable": false,
|
||
|
"type": "object",
|
||
|
"properties": {
|
||
|
"scheme": {
|
||
|
"nullable": false,
|
||
|
"type": "string",
|
||
|
"default": "http"
|
||
|
},
|
||
|
"host": {
|
||
|
"nullable": false,
|
||
|
"type": "string",
|
||
|
"default": "localhost"
|
||
|
},
|
||
|
"port": {
|
||
|
"nullable": false,
|
||
|
"type": "integer",
|
||
|
"default": 7845
|
||
|
},
|
||
|
"path": {
|
||
|
"nullable": false,
|
||
|
"type": "string",
|
||
|
"default": ""
|
||
|
}
|
||
|
},
|
||
|
"required": [
|
||
|
],
|
||
|
"additionalProperties": false,
|
||
|
"default": {}
|
||
|
}
|
||
|
},
|
||
|
"required": [
|
||
|
"version",
|
||
|
],
|
||
|
"additionalProperties": false
|
||
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
var _data : (null | any) = null;
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export function schema(
|
||
|
) : lib_plankton.conf.type_schema
|
||
|
{
|
||
|
return _schema;
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export function get(
|
||
|
) : any
|
||
|
{
|
||
|
if (_data === null) {
|
||
|
throw (new Error("conf not loaded yet"));
|
||
|
}
|
||
|
else {
|
||
|
return _data;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export async function init(
|
||
|
path : string
|
||
|
) : Promise<void>
|
||
|
{
|
||
|
_data = await lib_plankton.conf.load(
|
||
|
_schema,
|
||
|
path
|
||
|
);
|
||
|
return Promise.resolve<void>(undefined);
|
||
|
}
|
||
|
|
||
|
}
|