parsoid service: update, use declarative configuration
Old configuration format is disabled now (it can still be used, but with additional steps). This is a backwards incompatible change.
This commit is contained in:
parent
5bfaa2d3ad
commit
6bb292d42b
@ -68,6 +68,15 @@ following incompatible changes:</para>
|
|||||||
that may be in /etc.
|
that may be in /etc.
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Parsoid service now uses YAML configuration format.
|
||||||
|
<literal>service.parsoid.interwikis</literal> is now called
|
||||||
|
<literal>service.parsoid.wikis</literal> and is a list of either API URLs
|
||||||
|
or attribute sets as specified in parsoid's documentation.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
|
|
||||||
|
|
||||||
|
@ -144,6 +144,9 @@ with lib;
|
|||||||
# murmur
|
# murmur
|
||||||
(mkRenamedOptionModule [ "services" "murmur" "welcome" ] [ "services" "murmur" "welcometext" ])
|
(mkRenamedOptionModule [ "services" "murmur" "welcome" ] [ "services" "murmur" "welcometext" ])
|
||||||
|
|
||||||
|
# parsoid
|
||||||
|
(mkRemovedOptionModule [ "services" "parsoid" "interwikis" ] [ "services" "parsoid" "wikis" ])
|
||||||
|
|
||||||
# Options that are obsolete and have no replacement.
|
# Options that are obsolete and have no replacement.
|
||||||
(mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
|
(mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
|
||||||
(mkRemovedOptionModule [ "programs" "bash" "enable" ] "")
|
(mkRemovedOptionModule [ "programs" "bash" "enable" ] "")
|
||||||
|
@ -6,20 +6,21 @@ let
|
|||||||
|
|
||||||
cfg = config.services.parsoid;
|
cfg = config.services.parsoid;
|
||||||
|
|
||||||
conf = ''
|
confTree = {
|
||||||
exports.setup = function( parsoidConfig ) {
|
worker_heartbeat_timeout = 300000;
|
||||||
${toString (mapAttrsToList (name: str: "parsoidConfig.setInterwiki('${name}', '${str}');") cfg.interwikis)}
|
logging = { level = "info"; };
|
||||||
|
services = [{
|
||||||
|
module = "lib/index.js";
|
||||||
|
entrypoint = "apiServiceWorker";
|
||||||
|
conf = {
|
||||||
|
mwApis = map (x: if isAttrs x then x else { uri = x; }) cfg.wikis;
|
||||||
|
serverInterface = cfg.interface;
|
||||||
|
serverPort = cfg.port;
|
||||||
|
};
|
||||||
|
}];
|
||||||
|
};
|
||||||
|
|
||||||
parsoidConfig.serverInterface = "${cfg.interface}";
|
confFile = pkgs.writeText "config.yml" (builtins.toJSON (recursiveUpdate confTree cfg.extraConfig));
|
||||||
parsoidConfig.serverPort = ${toString cfg.port};
|
|
||||||
|
|
||||||
parsoidConfig.useSelser = true;
|
|
||||||
|
|
||||||
${cfg.extraConfig}
|
|
||||||
};
|
|
||||||
'';
|
|
||||||
|
|
||||||
confFile = builtins.toFile "localsettings.js" conf;
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
@ -38,9 +39,9 @@ in
|
|||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
interwikis = mkOption {
|
wikis = mkOption {
|
||||||
type = types.attrsOf types.str;
|
type = types.listOf (types.either types.str types.attrs);
|
||||||
example = { localhost = "http://localhost/api.php"; };
|
example = [ "http://localhost/api.php" ];
|
||||||
description = ''
|
description = ''
|
||||||
Used MediaWiki API endpoints.
|
Used MediaWiki API endpoints.
|
||||||
'';
|
'';
|
||||||
@ -71,8 +72,8 @@ in
|
|||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = mkOption {
|
extraConfig = mkOption {
|
||||||
type = types.lines;
|
type = types.attrs;
|
||||||
default = "";
|
default = {};
|
||||||
description = ''
|
description = ''
|
||||||
Extra configuration to add to parsoid configuration.
|
Extra configuration to add to parsoid configuration.
|
||||||
'';
|
'';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user