[mod] outputs:authelia-calls -> arc
This commit is contained in:
parent
b1d3b91638
commit
c124997a58
3 changed files with 60 additions and 4 deletions
|
@ -198,10 +198,11 @@ namespace _espe.conf
|
||||||
}
|
}
|
||||||
|
|
|
|
||||||
{
|
{
|
||||||
kind : "authelia_call";
|
kind : "arc";
|
||||||
data : {
|
data : {
|
||||||
http_scheme : ("http" | "https");
|
http_scheme : ("http" | "https");
|
||||||
http_host : string;
|
http_host : string;
|
||||||
|
http_port : int;
|
||||||
hash_salt : string;
|
hash_salt : string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -957,7 +958,55 @@ namespace _espe.conf
|
||||||
})) (conf_raw["settings"] ?? {})
|
})) (conf_raw["settings"] ?? {})
|
||||||
),
|
),
|
||||||
"admins": (conf_raw["admins"] ?? []),
|
"admins": (conf_raw["admins"] ?? []),
|
||||||
"outputs": (conf_raw["outputs"] ?? []),
|
"outputs": (
|
||||||
|
((node_outputs) => node_outputs.map(
|
||||||
|
(output_description : {kind : string; data : any;}) => {
|
||||||
|
const kind : string = output_description["kind"];
|
||||||
|
const node_options_data_raw = (output_description["data"] ?? {});
|
||||||
|
switch (kind) {
|
||||||
|
case "authelia_file": {
|
||||||
|
return {
|
||||||
|
"kind": kind,
|
||||||
|
"data": {
|
||||||
|
"path": (node_options_data_raw["path"] ?? "/var/authelia/users.yaml"),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "http": {
|
||||||
|
return {
|
||||||
|
"kind": kind,
|
||||||
|
"data": {
|
||||||
|
"scheme": (node_options_data_raw["scheme"] ?? "http"),
|
||||||
|
"host": (node_options_data_raw["host"] ?? "localhost"),
|
||||||
|
"path": (node_options_data_raw["path"] ?? ""),
|
||||||
|
"method": (node_options_data_raw["method"] ?? "post"),
|
||||||
|
"query": (node_options_data_raw["query"] ?? null),
|
||||||
|
"headers": (node_options_data_raw["headers"] ?? {"Content-Type": "application/json"}),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "arc": {
|
||||||
|
return {
|
||||||
|
"kind": kind,
|
||||||
|
"data": {
|
||||||
|
"http_scheme": (node_options_data_raw["scheme"] ?? "http"),
|
||||||
|
"http_host": (node_options_data_raw["http_host"] ?? "localhost"),
|
||||||
|
"http_port": (node_options_data_raw["http_port"] ?? 7463),
|
||||||
|
"hash_salt": node_options_data_raw["hash_salt"],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
throw (new Error("unhandled"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)) (conf_raw["outputs"] ?? [])
|
||||||
|
),
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,7 +340,7 @@ async function main(
|
||||||
return (() => _espe.service.member.output_http(output_description.data));
|
return (() => _espe.service.member.output_http(output_description.data));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "authelia_call": {
|
case "arc": {
|
||||||
return (() => _espe.service.member.output_authelia_call(output_description.data));
|
return (() => _espe.service.member.output_authelia_call(output_description.data));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -941,6 +941,7 @@ namespace _espe.service.member
|
||||||
output_parameters : {
|
output_parameters : {
|
||||||
http_scheme : ("http" | "https");
|
http_scheme : ("http" | "https");
|
||||||
http_host : string;
|
http_host : string;
|
||||||
|
http_port : int;
|
||||||
hash_salt : string;
|
hash_salt : string;
|
||||||
}
|
}
|
||||||
) : Promise<void>
|
) : Promise<void>
|
||||||
|
@ -953,7 +954,13 @@ namespace _espe.service.member
|
||||||
);
|
);
|
||||||
const http_request : lib_plankton.http.type_request = {
|
const http_request : lib_plankton.http.type_request = {
|
||||||
"scheme": output_parameters.http_scheme,
|
"scheme": output_parameters.http_scheme,
|
||||||
|
"host": lib_plankton.string.coin(
|
||||||
|
"{{host}}:{{port}}",
|
||||||
|
{
|
||||||
"host": output_parameters.http_host,
|
"host": output_parameters.http_host,
|
||||||
|
"port": output_parameters.http_port.toFixed(0),
|
||||||
|
}
|
||||||
|
),
|
||||||
"path": "/users/set",
|
"path": "/users/set",
|
||||||
"version": "HTTP/1.1",
|
"version": "HTTP/1.1",
|
||||||
"method": lib_plankton.http.enum_method.put,
|
"method": lib_plankton.http.enum_method.put,
|
||||||
|
|
Loading…
Add table
Reference in a new issue