Configuration¶
Purpose¶
This page documents the Jeni configuration module.
Responsibilities¶
The configuration module centralizes environment-variable helpers, API key defaults, local paths, logging configuration, model lists, application modes, UI labels, help text, regular-expression patterns, database paths, and branding assets.
API Reference¶
config
¶
Assembly: dongr
Filename: config.py
Author: Terry D. Eppler
Created: 05-31-2024
Last Modified By: Terry D. Eppler
Last Modified On: 05-01-2026
config.py
Copyright © 2024 Terry Eppler
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
You can contact me at: terryeppler@gmail.com or eppler.terry@epa.gov
throw_if
¶
Raise ValueError when a required value is empty.
Purpose
Provide a small, consistent guard for required arguments and configuration values. The
function treats falsy values as invalid and raises a ValueError containing the
caller-supplied argument or setting name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Name of the argument or configuration value being validated. |
required |
value
|
object
|
Value to validate. |
required |
Returns:
| Type | Description |
|---|---|
None
|
None. |
Raises:
| Type | Description |
|---|---|
ValueError
|
Raised when |
get_bool
¶
Read a Boolean environment variable using Fiddy's true-value convention.
Purpose
Convert environment-variable text into a deterministic Boolean value. Missing variables
return the caller-provided default. Values of 1, true, yes, y, and
on are treated as True; all other defined values are treated as False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Environment variable name. |
required |
default
|
bool
|
Default value used when the environment variable is not defined. |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
Parsed Boolean value. If parsing fails, the original |
get_int
¶
Read an integer environment variable with a deterministic fallback.
Purpose
Parse an optional environment variable as an integer while preserving a safe default when the variable is missing, empty, or invalid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Environment variable name. |
required |
default
|
int
|
Default integer value used when parsing is not possible. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Parsed integer value or the supplied default value. |
get_float
¶
Read a floating-point environment variable with a deterministic fallback.
Purpose
Parse an optional environment variable as a float while preserving a safe default when the variable is missing, empty, or invalid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Environment variable name. |
required |
default
|
float
|
Default floating-point value used when parsing is not possible. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Parsed floating-point value or the supplied default value. |
get_path
¶
Read a path environment variable and return a resolved Path.
Purpose
Resolve optional filesystem configuration from the environment. Missing variables return the resolved default path. Invalid values return the resolved default path rather than interrupting module import.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Environment variable name. |
required |
default
|
Path
|
Default path used when the environment variable is not defined. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Path |
Path
|
Resolved path value or resolved default path. |
get_text
¶
Read a text environment variable with a deterministic fallback.
Purpose
Return an environment variable as text while preserving the supplied default when the variable is missing or empty.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
Environment variable name. |
required |
default
|
str
|
Default text value. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Environment value or supplied default. |