Skip to content

Commit 9b1450d

Browse files
committed
feat(config): Add host parameter to config the socket db listen address
1 parent 1c57833 commit 9b1450d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/powerapi/cli/common_cli_parsing_manager.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ def __init__(self):
118118

119119
subparser_socket_input = SubgroupConfigParsingManager("socket")
120120
subparser_socket_input.add_argument(
121-
"p", "port", argument_type=int, help_text="specify port to bind the socket"
121+
"h", "host", help_text="Specify the host the socket should listen on", default_value='127.0.0.1'
122+
)
123+
subparser_socket_input.add_argument(
124+
"p", "port", help_text="Specify the port the socket should listen on", argument_type=int, default_value=9080,
122125
)
123126
subparser_socket_input.add_argument(
124127
"n", "name", help_text="specify puller name", default_value="puller_socket"

src/powerapi/cli/generator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def __init__(self, component_group_name: str):
172172
self.db_factory = {
173173
'mongodb': lambda db_config: MongoDB(report_type=db_config['model'], uri=db_config['uri'],
174174
db_name=db_config['db'], collection_name=db_config['collection']),
175-
'socket': lambda db_config: SocketDB(report_type=db_config['model'], port=db_config['port']),
175+
'socket': lambda db_config: SocketDB(db_config['model'], db_config['host'], db_config['port']),
176176
'csv': lambda db_config: CsvDB(report_type=db_config['model'], tags=gen_tag_list(db_config),
177177
current_path=os.getcwd() if 'directory' not in db_config else db_config[
178178
'directory'],

0 commit comments

Comments
 (0)