checkpoint
This commit is contained in:
parent
59e8ca812c
commit
6b3389c4b1
13 changed files with 608 additions and 188 deletions
|
|
@ -14,7 +14,47 @@ in {
|
|||
type = types.submoduleWith {
|
||||
modules = [../types/endpoint.nix];
|
||||
};
|
||||
default = name;
|
||||
default = {};
|
||||
apply = attrs:
|
||||
attrs
|
||||
// {
|
||||
__toString = self: let
|
||||
protocol =
|
||||
if self.protocol != null
|
||||
then "${self.protocol}://"
|
||||
else "";
|
||||
|
||||
port =
|
||||
if self.port != null
|
||||
then ":${toString self.port}"
|
||||
else "";
|
||||
|
||||
path =
|
||||
if self.path != null
|
||||
then "/${self.path}"
|
||||
else "";
|
||||
|
||||
query =
|
||||
if self.query != null
|
||||
then "?${toString self.query
|
||||
|> lib.attrsToList
|
||||
|> lib.map ({
|
||||
name,
|
||||
value,
|
||||
}: "${name}=${value}")}"
|
||||
else "";
|
||||
|
||||
hash =
|
||||
if self.hash != null
|
||||
then "#${toString self.hash
|
||||
|> lib.attrsToList
|
||||
|> lib.map ({
|
||||
name,
|
||||
value,
|
||||
}: "${name}=${value}")}"
|
||||
else "";
|
||||
in "${protocol}${self.host}${port}${path}${query}${hash}";
|
||||
};
|
||||
};
|
||||
|
||||
# protocol = mkOption {
|
||||
|
|
|
|||
|
|
@ -2,17 +2,18 @@
|
|||
inherit (lib) mkOption types;
|
||||
in {
|
||||
options = {
|
||||
protocol = mkOption {
|
||||
type = types.str;
|
||||
default = "http";
|
||||
};
|
||||
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "localhost";
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.port;
|
||||
};
|
||||
|
||||
protocol = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
type = types.nullOr types.port;
|
||||
default = null;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue