25 lines
658 B
Python
25 lines
658 B
Python
from __future__ import annotations
|
|
|
|
import argparse
|
|
|
|
from app.config import get_settings
|
|
from app.services.config_store import import_yaml_config_to_db
|
|
|
|
|
|
def main() -> None:
|
|
parser = argparse.ArgumentParser(description="Import YAML config into the sub-provider database")
|
|
parser.add_argument(
|
|
"--replace",
|
|
action="store_true",
|
|
help="Clear existing config rows before import",
|
|
)
|
|
args = parser.parse_args()
|
|
|
|
settings = get_settings()
|
|
import_yaml_config_to_db(settings.sources_file, replace_existing=args.replace)
|
|
print(f"Imported config into {settings.database_url}")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|