Merging schema_extension #9
@@ -42,6 +42,7 @@ from pathlib import Path
|
|||||||
# Add parent directory to path so we can import alpine_bits_python
|
# Add parent directory to path so we can import alpine_bits_python
|
||||||
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
sys.path.insert(0, str(Path(__file__).parent.parent.parent))
|
||||||
|
|
||||||
|
import yaml
|
||||||
from sqlalchemy import select
|
from sqlalchemy import select
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
|
||||||
|
|
||||||
@@ -418,14 +419,19 @@ async def main():
|
|||||||
if args.target:
|
if args.target:
|
||||||
target_url = args.target
|
target_url = args.target
|
||||||
elif args.target_config:
|
elif args.target_config:
|
||||||
# Load target config file
|
# Load target config file manually (simpler YAML without secrets)
|
||||||
_LOGGER.info("Loading target database config from: %s", args.target_config)
|
_LOGGER.info("Loading target database config from: %s", args.target_config)
|
||||||
try:
|
try:
|
||||||
target_config = load_config(args.target_config)
|
config_path = Path(args.target_config)
|
||||||
target_url = get_database_url(target_config)
|
with config_path.open() as f:
|
||||||
|
target_config = yaml.safe_load(f)
|
||||||
|
target_url = target_config["database"]["url"]
|
||||||
_LOGGER.info("Successfully loaded target config")
|
_LOGGER.info("Successfully loaded target config")
|
||||||
except (FileNotFoundError, ValueError, KeyError):
|
except (FileNotFoundError, ValueError, KeyError):
|
||||||
_LOGGER.exception("Failed to load target config")
|
_LOGGER.exception("Failed to load target config")
|
||||||
|
_LOGGER.info(
|
||||||
|
"Config file should contain: database.url with PostgreSQL connection"
|
||||||
|
)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
import os
|
import os
|
||||||
|
|||||||
Reference in New Issue
Block a user