mirror of
https://github.com/juspay/services-flake.git
synced 2024-09-11 04:15:36 +03:00
change clickhouse extraConfig
type to yaml (#99)
* change clickhouse `extraConfig` type to yaml * update clickhouse doc
This commit is contained in:
parent
7593351c71
commit
76beca31cc
@ -23,9 +23,9 @@ Clickhouse has [HTTP Interface](https://clickhouse.com/docs/en/interfaces/http)
|
||||
{
|
||||
services.clickhouse."clickhouse-1" = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
http_port: 9050
|
||||
'';
|
||||
extraConfig = {
|
||||
http_port = 9050
|
||||
};
|
||||
};
|
||||
}
|
||||
```
|
||||
|
@ -2,16 +2,12 @@
|
||||
services.clickhouse."clickhouse1" = {
|
||||
enable = true;
|
||||
port = 9000;
|
||||
extraConfig = ''
|
||||
http_port: 9050
|
||||
'';
|
||||
extraConfig.http_port = 9050;
|
||||
};
|
||||
services.clickhouse."clickhouse2" = {
|
||||
enable = true;
|
||||
port = 9001;
|
||||
extraConfig = ''
|
||||
http_port: 9051
|
||||
'';
|
||||
extraConfig.http_port = 9051;
|
||||
initialDatabases = [
|
||||
{
|
||||
name = "sample_db";
|
||||
|
@ -2,6 +2,7 @@
|
||||
{ pkgs, lib, name, config, ... }:
|
||||
let
|
||||
inherit (lib) types;
|
||||
yamlFormat = pkgs.formats.yaml { };
|
||||
in
|
||||
{
|
||||
options = {
|
||||
@ -27,9 +28,9 @@ in
|
||||
};
|
||||
|
||||
extraConfig = lib.mkOption {
|
||||
type = types.lines;
|
||||
type = yamlFormat.type;
|
||||
description = "Additional configuration to be appended to `clickhouse-config.yaml`.";
|
||||
default = "";
|
||||
default = { };
|
||||
};
|
||||
|
||||
initialDatabases = lib.mkOption {
|
||||
@ -73,22 +74,26 @@ in
|
||||
default = {
|
||||
processes =
|
||||
let
|
||||
clickhouseConfig = pkgs.writeText "clickhouse-config.yaml" ''
|
||||
logger:
|
||||
level: warning
|
||||
console: 1
|
||||
tcp_port: ${toString config.port}
|
||||
default_profile: default
|
||||
default_database: default
|
||||
path: ${config.dataDir}/clickhouse
|
||||
tmp_path: ${config.dataDir}/clickhouse/tmp
|
||||
user_files_path: ${config.dataDir}/clickhouse/user_files
|
||||
format_schema_path: ${config.dataDir}/clickhouse/format_schemas
|
||||
user_directories:
|
||||
users_xml:
|
||||
path: ${config.package}/etc/clickhouse-server/users.xml
|
||||
${config.extraConfig}
|
||||
'';
|
||||
clickhouseConfig = yamlFormat.generate "clickhouse-config.yaml" (
|
||||
{
|
||||
logger = {
|
||||
level = "warning";
|
||||
console = 1;
|
||||
};
|
||||
tcp_port = "${toString config.port}";
|
||||
default_profile = "default";
|
||||
default_database = "default";
|
||||
path = "${config.dataDir}/clickhouse";
|
||||
tmp_path = "${config.dataDir}/clickhouse/tmp";
|
||||
user_files_path = "${config.dataDir}/clickhouse/user_files";
|
||||
format_schema_path = "${config.dataDir}/clickhouse/format_schemas";
|
||||
user_directories = {
|
||||
users_xml = {
|
||||
path = "${config.package}/etc/clickhouse-server/users.xml";
|
||||
};
|
||||
};
|
||||
} // config.extraConfig
|
||||
);
|
||||
in
|
||||
{
|
||||
# DB initialization
|
||||
|
Loading…
Reference in New Issue
Block a user