@@ -34,6 +34,7 @@ def custom_graph(
34
34
fork_observer : bool ,
35
35
fork_obs_query_interval : int ,
36
36
caddy : bool ,
37
+ logging : bool ,
37
38
):
38
39
datadir .mkdir (parents = False , exist_ok = False )
39
40
# Generate network.yaml
@@ -79,10 +80,13 @@ def custom_graph(
79
80
# Generate node-defaults.yaml
80
81
default_yaml_path = files ("resources.networks" ).joinpath ("node-defaults.yaml" )
81
82
with open (str (default_yaml_path )) as f :
82
- defaults_yaml_content = f .read ()
83
+ defaults_yaml_content = yaml .safe_load (f )
84
+
85
+ # Configure logging
86
+ defaults_yaml_content ["collectLogs" ] = logging
83
87
84
88
with open (os .path .join (datadir , "node-defaults.yaml" ), "w" ) as f :
85
- f . write (defaults_yaml_content )
89
+ yaml . dump (defaults_yaml_content , f , default_flow_style = False , sort_keys = False )
86
90
87
91
click .echo (
88
92
f"Project '{ datadir } ' has been created with 'network.yaml' and 'node-defaults.yaml'."
@@ -175,6 +179,15 @@ def inquirer_create_network(project_path: Path):
175
179
type = int ,
176
180
default = 20 ,
177
181
)
182
+
183
+ logging = click .prompt (
184
+ click .style (
185
+ "\n Would you like to enable grafana logging on the network?" , fg = "blue" , bold = True
186
+ ),
187
+ type = bool ,
188
+ default = False ,
189
+ )
190
+ caddy = fork_observer | logging
178
191
custom_network_path = project_path / "networks" / net_answers ["network_name" ]
179
192
click .secho ("\n Generating custom network..." , fg = "yellow" , bold = True )
180
193
custom_graph (
@@ -184,7 +197,8 @@ def inquirer_create_network(project_path: Path):
184
197
custom_network_path ,
185
198
fork_observer ,
186
199
fork_observer_query_interval ,
187
- fork_observer , # This enables caddy whenever fork-observer is enabled
200
+ caddy ,
201
+ logging ,
188
202
)
189
203
return custom_network_path
190
204
0 commit comments