44 lines
525 B
TypeScript
44 lines
525 B
TypeScript
|
namespace _aum.conf
|
||
|
{
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export type type_data = {
|
||
|
backend : {
|
||
|
scheme : string;
|
||
|
host : string;
|
||
|
port : int;
|
||
|
path_base : string;
|
||
|
};
|
||
|
};
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
var _data : (null | type_data) = null;
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export async function load(
|
||
|
) : Promise<void>
|
||
|
{
|
||
|
_data = lib_plankton.json.decode(await lib_plankton.file.read("conf.json"));
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
*/
|
||
|
export function get(
|
||
|
) : type_data
|
||
|
{
|
||
|
if (_data === null) {
|
||
|
throw (new Error("conf not loaded yet"));
|
||
|
}
|
||
|
else {
|
||
|
return _data;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|