Skip to content

Commit 6d8bf78

Browse files
authored
Merge pull request wazuh#29419 from wazuh/bug/29416-server-default-config
Set default for server in centralized configuration - Implementation
2 parents 407842a + 31fb0d2 commit 6d8bf78

File tree

3 files changed

+5
-13
lines changed

3 files changed

+5
-13
lines changed

framework/wazuh/core/config/models/central_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Config(WazuhConfigBaseModel):
5151
Configuration for the communications API. Default is an instance of CommsAPIConfig.
5252
"""
5353

54-
server: ServerConfig
54+
server: ServerConfig = ServerConfig()
5555
indexer: IndexerConfig
5656
engine: EngineConfig = EngineConfig()
5757
management_api: ManagementAPIConfig = ManagementAPIConfig()

framework/wazuh/core/config/models/tests/test_central_config.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
EngineConfig,
1010
IndexerConfig,
1111
ManagementAPIConfig,
12+
ServerConfig,
1213
)
1314

1415

@@ -29,18 +30,14 @@ def test_config_sections_ko():
2930
'username': 'user_example',
3031
'password': 'password_example',
3132
},
32-
'server': {},
3333
},
3434
{
35-
'server': {
36-
'update_check': False,
37-
'logging.level': 'info',
38-
},
3935
'indexer': {
4036
'hosts': [{'host': 'localhost', 'port': 9200}],
4137
'username': 'user_example',
4238
'password': 'password_example',
4339
},
40+
'server': {},
4441
'engine': {},
4542
'management_api': {},
4643
'communications_api': {},
@@ -53,10 +50,8 @@ def test_config_default_values(init_values, expected):
5350
with patch.object(ValidateFilePathMixin, '_validate_file_path', return_value=None):
5451
config = Config(**init_values)
5552

56-
assert config.server.update_check == expected['server']['update_check']
57-
assert config.server.logging.level == expected['server']['logging.level']
58-
5953
assert config.indexer == IndexerConfig(**expected['indexer'])
6054
assert config.engine == EngineConfig(**expected['engine'])
55+
assert config.server == ServerConfig(**expected['server'])
6156
assert config.management_api == ManagementAPIConfig(**expected['management_api'])
6257
assert config.communications_api == CommsAPIConfig(**expected['communications_api'])

framework/wazuh/core/config/tests/test_client.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,13 @@
1414
from wazuh.core.config.models.server import ServerConfig
1515

1616
mock_config_data = {
17-
'server': {
18-
'logging': {'level': 'debug2'},
19-
'cti': {},
20-
},
2117
'indexer': {
2218
'hosts': [{'host': 'localhost', 'port': 9200}],
2319
'username': 'admin',
2420
'password': 'password',
2521
'ssl': {'use_ssl': False, 'key': '', 'certificate': '', 'certificate_authorities': ['']},
2622
},
23+
'server': {},
2724
'engine': {},
2825
'management_api': {},
2926
'communications_api': {},

0 commit comments

Comments
 (0)