-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b3c1b89
commit 81c0afb
Showing
11 changed files
with
143 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os.path | ||
import socket | ||
from copy import deepcopy | ||
|
||
from ch_tools.common.utils import deep_merge | ||
from ch_tools.common.yaml import load_yaml | ||
|
||
CONFIG_FILE = "/etc/clickhouse-tools/config.yaml" | ||
DEFAULT_CONFIG = { | ||
"clickhouse": { | ||
"host": socket.getfqdn(), | ||
"protocol": "https", | ||
"insecure": False, | ||
"port": 8443, | ||
"user": None, | ||
"password": None, | ||
"timeout": 60, | ||
"settings": {}, | ||
"monitoring_user": None, | ||
"monitoring_password": None, | ||
}, | ||
} | ||
|
||
|
||
def load_config(): | ||
""" | ||
Read config file, apply defaults and return result configuration. | ||
""" | ||
config = deepcopy(DEFAULT_CONFIG) | ||
|
||
if os.path.exists(CONFIG_FILE): | ||
loaded_config = load_yaml(CONFIG_FILE) | ||
deep_merge(config, loaded_config) | ||
|
||
return config |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.