db
This commit is contained in:
24
app/import_config.py
Normal file
24
app/import_config.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user