File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,15 +88,16 @@ class CollectionSettings(BaseSettings):
8888 """ List of viewer names to enable for this collection. If empty, all viewers are available. """
8989
9090
91- def load_collection_settings (settings_file : str ) -> CollectionSettings :
92- """ Load the collection settings from a file """
93- with open (settings_file ) as f :
94- settings_dict = yaml .safe_load (f )
91+ def load_collection_settings (settings_content : str ) -> CollectionSettings :
92+ """ Load the collection settings from a string """
93+ settings_dict = yaml .safe_load (settings_content )
9594 return CollectionSettings .model_validate (settings_dict )
9695
9796
9897if __name__ == "__main__" :
9998 import sys
10099 import pprint
101- settings = load_collection_settings (sys .argv [1 ])
100+ with open (sys .argv [1 ], 'r' ) as f :
101+ settings_content = f .read ()
102+ settings = load_collection_settings (settings_content )
102103 pprint .pprint (settings .model_dump ())
Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ async def startup_event():
9191 # Load collection settings
9292 app .collections = {}
9393 for collection in app .db .get_collections ():
94- collection_settings = load_collection_settings (collection .settings_path )
94+ collection_settings = load_collection_settings (collection .settings_content )
9595 app .collections [collection .name ] = collection_settings
9696
9797 for s in collection_settings .filters :
You can’t perform that action at this time.
0 commit comments