1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
use Deserialize;
use env;
use PathBuf;
/// Environment variable name for controlling error handling behavior.
///
/// When set, this variable determines whether Genja should raise (panic/abort) on errors
/// or handle them gracefully. Accepts boolean-like values such as "true", "false", "yes",
/// "no", "1", "0", "on", "off" (case-insensitive).
///
/// Default: `false` (errors are handled gracefully)
pub const ENV_RAISE_ON_ERROR: &str = "GENJA_CORE_RAISE_ON_ERROR";
/// Environment variable name for specifying the inventory plugin.
///
/// This variable determines which inventory plugin implementation should be used
/// for loading and managing host inventory data.
///
/// Default: `"FileInventoryPlugin"`
pub const ENV_INVENTORY_PLUGIN: &str = "GENJA_INVENTORY_PLUGIN";
/// Environment variable name for specifying the runner plugin.
///
/// This variable determines which runner plugin implementation should be used
/// for executing tasks across hosts (e.g., "threaded", "serial").
///
/// Default: `"threaded"`
pub const ENV_RUNNER_PLUGIN: &str = "GENJA_RUNNER_PLUGIN";
/// Environment variable name for setting the logging level.
///
/// This variable controls the verbosity of log output. Valid values include
/// "trace", "debug", "info", "warn", and "error".
///
/// Default: `"info"`
pub const ENV_LOG_LEVEL: &str = "GENJA_LOGGING_LEVEL";
/// Environment variable name for specifying the log file path.
///
/// This variable determines where log output should be written. If not set,
/// logs are written to `genja.log` in the current working directory.
///
/// Default: `genja.log` in the current working directory
pub const ENV_LOG_FILE: &str = "GENJA_LOGGING_LOG_FILE";
/// Environment variable name for enabling console logging.
///
/// When set, this variable determines whether logs should be written to the console
/// in addition to the log file. Accepts boolean-like values such as "true", "false",
/// "yes", "no", "1", "0", "on", "off" (case-insensitive).
///
/// Default: `false` (console logging disabled)
pub const ENV_LOG_TO_CONSOLE: &str = "GENJA_LOGGING_TO_CONSOLE";
/// Parses a string into a boolean value using loose matching rules.
///
/// This function accepts various common string representations of boolean values,
/// performing case-insensitive matching after trimming whitespace. It recognizes
/// multiple formats for both true and false values.
///
/// # Parameters
///
/// * `s` - A string slice containing the value to parse. Leading and trailing
/// whitespace will be trimmed before parsing.
///
/// # Returns
///
/// * `Some(true)` - If the string matches any of: "true", "t", "1", "yes", "y", "on"
/// (case-insensitive)
/// * `Some(false)` - If the string matches any of: "false", "f", "0", "no", "n", "off"
/// (case-insensitive)
/// * `None` - If the string does not match any recognized boolean representation
pub
pub
pub
/// Retrieves the inventory plugin configuration from environment variables.
///
/// This function checks the `GENJA_INVENTORY_PLUGIN` environment variable to determine
/// which inventory plugin implementation should be used. If the environment variable is
/// not set or cannot be read, it returns a default value.
///
/// # Returns
///
/// Returns a `String` containing the name of the inventory plugin to use. If the
/// `GENJA_INVENTORY_PLUGIN` environment variable is set, returns its value. Otherwise,
/// returns `"FileInventoryPlugin"` as the default.
///
/// See tests in this module for behavioral verification.
pub
/// Returns the default runner plugin from `GENJA_RUNNER_PLUGIN`, or "threaded".
///
/// See tests in this module for behavioral verification.
pub
/// Returns the default runner options JSON.
///
/// See tests in this module for behavioral verification.
pub
/// Returns the default max task depth for runner execution.
///
/// See tests in this module for behavioral verification.
pub
/// Returns the default maximum number of connection attempts for runner execution.
///
/// See tests in this module for behavioral verification.
pub
/// Returns the default log level from `GENJA_LOGGING_LEVEL`, or "info".
///
/// See tests in this module for behavioral verification.
pub
/// Returns the default console logging flag from `GENJA_LOGGING_TO_CONSOLE`.
///
/// See tests in this module for behavioral verification.
pub
/// Returns the default log file path, preferring `GENJA_LOGGING_LOG_FILE` when set.
///
/// When the environment variable is not set, defaults to `genja.log` in the
/// current working directory.
///
/// See tests in this module for behavioral verification.
pub