ccproxy.config.utils¶
ccproxy.config.utils
¶
Configuration utilities - constants, validators, discovery, and scheduler.
SchedulerSettings
¶
Bases: BaseSettings
Configuration settings for the unified scheduler system.
Controls global scheduler behavior and individual task configurations. Settings can be configured via environment variables with SCHEDULER__ prefix.
validate_host
¶
Validate host address.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
host
|
str
|
Host address to validate |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated host address |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If host is invalid |
Source code in ccproxy/config/utils.py
validate_port
¶
Validate port number.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
port
|
int | str
|
Port number to validate |
required |
Returns:
| Type | Description |
|---|---|
int
|
The validated port number |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If port is invalid |
Source code in ccproxy/config/utils.py
validate_url
¶
Validate URL format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
URL to validate |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated URL |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If URL is invalid |
Source code in ccproxy/config/utils.py
validate_path
¶
Validate file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
Path to validate |
required |
Returns:
| Type | Description |
|---|---|
Path
|
The validated Path object |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If path is invalid |
Source code in ccproxy/config/utils.py
validate_log_level
¶
Validate log level.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
level
|
str
|
Log level to validate |
required |
Returns:
| Type | Description |
|---|---|
str
|
The validated log level |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If log level is invalid |
Source code in ccproxy/config/utils.py
validate_cors_origins
¶
Validate CORS origins.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
origins
|
list[str]
|
List of origin URLs to validate |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
The validated list of origins |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If any origin is invalid |
Source code in ccproxy/config/utils.py
validate_timeout
¶
Validate timeout value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
int | float
|
Timeout value to validate |
required |
Returns:
| Type | Description |
|---|---|
int | float
|
The validated timeout value |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If timeout is invalid |
Source code in ccproxy/config/utils.py
validate_config_dict
¶
Validate configuration dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
dict[str, Any]
|
Configuration dictionary to validate |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The validated configuration dictionary |
Raises:
| Type | Description |
|---|---|
ConfigValidationError
|
If configuration is invalid |
Source code in ccproxy/config/utils.py
find_toml_config_file
¶
Find the TOML configuration file for ccproxy.
Searches in the following order: 1. .ccproxy.toml in current directory 2. ccproxy.toml in git repository root (if in a git repo) 3. config.toml in XDG_CONFIG_HOME/ccproxy/
Source code in ccproxy/config/utils.py
find_git_root
¶
Find the root directory of a git repository.
Source code in ccproxy/config/utils.py
get_ccproxy_config_dir
¶
Get the ccproxy configuration directory.
Returns:
| Type | Description |
|---|---|
Path
|
Path to the ccproxy configuration directory within XDG_CONFIG_HOME. |
get_claude_cli_config_dir
¶
Get the Claude CLI configuration directory.
Returns:
| Type | Description |
|---|---|
Path
|
Path to the Claude CLI configuration directory within XDG_CONFIG_HOME. |
get_claude_docker_home_dir
¶
Get the Claude Docker home directory.
Returns:
| Type | Description |
|---|---|
Path
|
Path to the Claude Docker home directory within XDG_DATA_HOME. |