Skip to content

Commit

Permalink
Merge pull request #1683 from iand675/temporal-dynamic-config
Browse files Browse the repository at this point in the history
Support temporal dynamic config args
  • Loading branch information
domenkozar authored Jan 24, 2025
2 parents 5cd6c94 + 4a4532d commit 4d65397
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 12 deletions.
32 changes: 32 additions & 0 deletions docs/reference/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -81173,6 +81173,38 @@ package



## services.temporal.dynamicConfig



Dynamic configuration for the Temporal server.



*Type:*
attribute set of string



*Default:*
` { } `



*Example:*

```
{
"frontend.namespacerps" = "2500";
"frontend.rps" = "2500";
}
```

*Declared by:*
- [https://github.com/cachix/devenv/blob/main/src/modules/services/temporal.nix](https://github.com/cachix/devenv/blob/main/src/modules/services/temporal.nix)



## services.temporal.ip


Expand Down
29 changes: 29 additions & 0 deletions docs/supported-services/temporal.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

## services\.temporal\.enable



Whether to enable Temporal process\.


Expand Down Expand Up @@ -42,6 +44,33 @@ package



## services\.temporal\.dynamicConfig

Dynamic configuration for the Temporal server\.



*Type:*
attribute set of string



*Default:*
` { } `



*Example:*

```
{
"frontend.namespacerps" = "2500";
"frontend.rps" = "2500";
}
```



## services\.temporal\.ip


Expand Down
40 changes: 28 additions & 12 deletions src/modules/services/temporal.nix
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
{ pkgs, lib, config, ... }:
{ pkgs
, lib
, config
, ...
}:

let
cfg = config.services.temporal;
types = lib.types;

databaseFile = config.env.DEVENV_STATE + "/temporal.sqlite";

commandArgs = [
"--log-format=pretty"
"--ip=${cfg.ip}"
"--port=${toString cfg.port}"
"--headless=${lib.boolToString (!cfg.ui.enable)}"
"--ui-ip=${cfg.ui.ip}"
"--ui-port=${toString cfg.ui.port}"
] ++
(lib.forEach cfg.namespaces (namespace: "--namespace=${namespace}")) ++
(lib.optionals (!cfg.state.ephemeral) [ "--db-filename=${databaseFile}" ]) ++
(lib.mapAttrsToList (name: value: "--sqlite-pragma ${name}=${value}") cfg.state.sqlite-pragma);
commandArgs =
[
"--log-format=pretty"
"--ip=${cfg.ip}"
"--port=${toString cfg.port}"
"--headless=${lib.boolToString (!cfg.ui.enable)}"
"--ui-ip=${cfg.ui.ip}"
"--ui-port=${toString cfg.ui.port}"
]
++ (lib.forEach cfg.namespaces (namespace: "--namespace=${namespace}"))
++ (lib.optionals (!cfg.state.ephemeral) [ "--db-filename=${databaseFile}" ])
++ (lib.mapAttrsToList (name: value: "--sqlite-pragma ${name}=${value}") cfg.state.sqlite-pragma)
++ (lib.mapAttrsToList (name: value: "--dynamic-config-value ${name}=${value}") cfg.dynamicConfig);
in
{
options.services.temporal = {
Expand Down Expand Up @@ -101,6 +107,16 @@ in
default = { };
description = "State configuration.";
};

dynamicConfig = lib.mkOption {
type = types.attrsOf types.str;
default = { };
description = "Dynamic configuration for the Temporal server.";
example = {
"frontend.rps" = "2500";
"frontend.namespacerps" = "2500";
};
};
};

config = lib.mkIf cfg.enable {
Expand Down

0 comments on commit 4d65397

Please sign in to comment.