Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
66 lines
2.0 KiB
Python
66 lines
2.0 KiB
Python
# Copyright (C) 2025 AIDC-AI
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
"""
|
|
Configuration loader - Pure YAML
|
|
|
|
Handles loading and saving configuration from/to YAML files.
|
|
"""
|
|
from pathlib import Path
|
|
import yaml
|
|
from loguru import logger
|
|
|
|
|
|
def load_config_dict(config_path: str = "config.yaml") -> dict:
|
|
"""
|
|
Load configuration from YAML file
|
|
|
|
Args:
|
|
config_path: Path to config file
|
|
|
|
Returns:
|
|
Configuration dictionary
|
|
"""
|
|
config_file = Path(config_path)
|
|
|
|
if not config_file.exists():
|
|
logger.warning(f"Config file not found: {config_path}")
|
|
logger.info("Using default configuration")
|
|
return {}
|
|
|
|
try:
|
|
with open(config_file, 'r', encoding='utf-8') as f:
|
|
data = yaml.safe_load(f) or {}
|
|
logger.info(f"Configuration loaded from {config_path}")
|
|
return data
|
|
except Exception as e:
|
|
logger.error(f"Failed to load config: {e}")
|
|
return {}
|
|
|
|
|
|
def save_config_dict(config: dict, config_path: str = "config.yaml"):
|
|
"""
|
|
Save configuration to YAML file
|
|
|
|
Args:
|
|
config: Configuration dictionary
|
|
config_path: Path to config file
|
|
"""
|
|
try:
|
|
with open(config_path, 'w', encoding='utf-8') as f:
|
|
yaml.dump(config, f, allow_unicode=True, default_flow_style=False, sort_keys=False)
|
|
logger.info(f"Configuration saved to {config_path}")
|
|
except Exception as e:
|
|
logger.error(f"Failed to save config: {e}")
|
|
raise
|
|
|