nixos/prosody: remove obsoloted http_upload and replace it with http_file_share
This commit is contained in:
parent
c26ed9f391
commit
4e12c9b92e
@ -418,43 +418,9 @@ let
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
uploadHttpOpts = _: {
|
httpFileShareOpts =
|
||||||
options = {
|
{ config, options, ... }:
|
||||||
domain = mkOption {
|
{
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "Domain name for the http-upload service";
|
|
||||||
};
|
|
||||||
uploadFileSizeLimit = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "50 * 1024 * 1024";
|
|
||||||
description = "Maximum file size, in bytes. Defaults to 50MB.";
|
|
||||||
};
|
|
||||||
uploadExpireAfter = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
default = "60 * 60 * 24 * 7";
|
|
||||||
description = "Max age of a file before it gets deleted, in seconds.";
|
|
||||||
};
|
|
||||||
userQuota = mkOption {
|
|
||||||
type = types.nullOr types.int;
|
|
||||||
default = null;
|
|
||||||
example = 1234;
|
|
||||||
description = ''
|
|
||||||
Maximum size of all uploaded files per user, in bytes. There
|
|
||||||
will be no quota if this option is set to null.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
httpUploadPath = mkOption {
|
|
||||||
type = types.str;
|
|
||||||
description = ''
|
|
||||||
Directory where the uploaded files will be stored when the http_upload module is used.
|
|
||||||
By default, uploaded files are put in a sub-directory of the default Prosody storage path (usually /var/lib/prosody).
|
|
||||||
'';
|
|
||||||
default = "/var/lib/prosody";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
httpFileShareOpts = _: {
|
|
||||||
freeformType =
|
freeformType =
|
||||||
with types;
|
with types;
|
||||||
let
|
let
|
||||||
@ -469,10 +435,32 @@ let
|
|||||||
// {
|
// {
|
||||||
description = "int, bool, string or list of them";
|
description = "int, bool, string or list of them";
|
||||||
};
|
};
|
||||||
options.domain = mkOption {
|
options = {
|
||||||
|
domain = mkOption {
|
||||||
type = with types; nullOr str;
|
type = with types; nullOr str;
|
||||||
description = "Domain name for a http_file_share service.";
|
description = "Domain name for a http_file_share service.";
|
||||||
};
|
};
|
||||||
|
size_limit = mkOption {
|
||||||
|
type = types.int;
|
||||||
|
default = 10 * 1024 * 1024;
|
||||||
|
defaultText = "10 * 1024 * 1024";
|
||||||
|
description = "Maximum file size, in bytes.";
|
||||||
|
};
|
||||||
|
expires_after = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "1 week";
|
||||||
|
description = "Max age of a file before it gets deleted.";
|
||||||
|
};
|
||||||
|
daily_quota = mkOption {
|
||||||
|
type = types.nullOr types.int;
|
||||||
|
default = 10 * config.size_limit;
|
||||||
|
defaultText = lib.literalExpression "10 * ${options.size_limit}";
|
||||||
|
example = "100*1024*1024";
|
||||||
|
description = ''
|
||||||
|
Maximum size of daily uploaded files per user, in bytes.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
vHostOpts = _: {
|
vHostOpts = _: {
|
||||||
@ -505,12 +493,7 @@ let
|
|||||||
|
|
||||||
configFile =
|
configFile =
|
||||||
let
|
let
|
||||||
httpDiscoItems =
|
httpDiscoItems = optional (cfg.httpFileShare != null) {
|
||||||
optional (cfg.uploadHttp != null) {
|
|
||||||
url = cfg.uploadHttp.domain;
|
|
||||||
description = "HTTP upload endpoint";
|
|
||||||
}
|
|
||||||
++ optional (cfg.httpFileShare != null) {
|
|
||||||
url = cfg.httpFileShare.domain;
|
url = cfg.httpFileShare.domain;
|
||||||
description = "HTTP file share endpoint";
|
description = "HTTP file share endpoint";
|
||||||
};
|
};
|
||||||
@ -592,18 +575,9 @@ let
|
|||||||
${muc.extraConfig}
|
${muc.extraConfig}
|
||||||
'') cfg.muc}
|
'') cfg.muc}
|
||||||
|
|
||||||
${lib.optionalString (cfg.uploadHttp != null) ''
|
|
||||||
Component ${toLua cfg.uploadHttp.domain} "http_upload"
|
|
||||||
http_upload_file_size_limit = ${cfg.uploadHttp.uploadFileSizeLimit}
|
|
||||||
http_upload_expire_after = ${cfg.uploadHttp.uploadExpireAfter}
|
|
||||||
${lib.optionalString (
|
|
||||||
cfg.uploadHttp.userQuota != null
|
|
||||||
) "http_upload_quota = ${toLua cfg.uploadHttp.userQuota}"}
|
|
||||||
http_upload_path = ${toLua cfg.uploadHttp.httpUploadPath}
|
|
||||||
''}
|
|
||||||
|
|
||||||
${lib.optionalString (cfg.httpFileShare != null) ''
|
${lib.optionalString (cfg.httpFileShare != null) ''
|
||||||
Component ${toLua cfg.httpFileShare.domain} "http_file_share"
|
Component ${toLua cfg.httpFileShare.domain} "http_file_share"
|
||||||
|
modules_disabled = { "s2s" }
|
||||||
${settingsToLua " http_file_share_" (cfg.httpFileShare // { domain = null; })}
|
${settingsToLua " http_file_share_" (cfg.httpFileShare // { domain = null; })}
|
||||||
''}
|
''}
|
||||||
|
|
||||||
@ -812,20 +786,11 @@ in
|
|||||||
description = "Additional path in which to look find plugins/modules";
|
description = "Additional path in which to look find plugins/modules";
|
||||||
};
|
};
|
||||||
|
|
||||||
uploadHttp = mkOption {
|
|
||||||
description = ''
|
|
||||||
Configures the old Prosody builtin HTTP server to handle user uploads.
|
|
||||||
'';
|
|
||||||
type = types.nullOr (types.submodule uploadHttpOpts);
|
|
||||||
default = null;
|
|
||||||
example = {
|
|
||||||
domain = "uploads.my-xmpp-example-host.org";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
httpFileShare = mkOption {
|
httpFileShare = mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
Configures the http_file_share module to handle user uploads.
|
Configures the http_file_share module to handle user uploads.
|
||||||
|
|
||||||
|
See <https://prosody.im/doc/modules/mod_http_file_share> for a full list of options.
|
||||||
'';
|
'';
|
||||||
type = types.nullOr (types.submodule httpFileShareOpts);
|
type = types.nullOr (types.submodule httpFileShareOpts);
|
||||||
default = null;
|
default = null;
|
||||||
@ -914,6 +879,12 @@ in
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imports = [
|
||||||
|
(lib.mkRemovedOptionModule [ "services" "prosody" "uploadHttp" ]
|
||||||
|
"mod_http_upload has been obsoloted and been replaced by mod_http_file_share which can be configured with httpFileShare options."
|
||||||
|
)
|
||||||
|
];
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
assertions =
|
assertions =
|
||||||
let
|
let
|
||||||
@ -936,10 +907,9 @@ in
|
|||||||
+ genericErrMsg;
|
+ genericErrMsg;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
assertion = cfg.uploadHttp != null || cfg.httpFileShare != null || !cfg.xmppComplianceSuite;
|
assertion = cfg.httpFileShare != null || !cfg.xmppComplianceSuite;
|
||||||
message = ''
|
message = ''
|
||||||
You need to setup the http_upload or http_file_share modules through config.services.prosody.uploadHttp
|
You need to setup http_file_share modules through config.services.prosody.httpFileShare to comply with XEP-0423.
|
||||||
or config.services.prosody.httpFileShare to comply with XEP-0423.
|
|
||||||
''
|
''
|
||||||
+ genericErrMsg;
|
+ genericErrMsg;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ import ../make-test-python.nix {
|
|||||||
domain = "conference.example.com";
|
domain = "conference.example.com";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
uploadHttp = {
|
httpFileShare = {
|
||||||
domain = "uploads.example.com";
|
domain = "uploads.example.com";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -49,7 +49,6 @@ stdenv.mkDerivation (finalAttrs: {
|
|||||||
# default setup.
|
# default setup.
|
||||||
nixosModuleDeps = [
|
nixosModuleDeps = [
|
||||||
"cloud_notify"
|
"cloud_notify"
|
||||||
"http_upload"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
# A note to all those merging automated updates: Please also update this
|
# A note to all those merging automated updates: Please also update this
|
||||||
|
Loading…
x
Reference in New Issue
Block a user