mosquito / pypi-server

Tornado based server like pypi.python.org. With caching from pypi.
MIT License
120 stars 38 forks source link

Default Sqlite metadata database doesn't use configured --storage directory #29

Open da4089 opened 6 years ago

da4089 commented 6 years ago

If using the --storage option, and defaulting to Sqlite database, the metadata.db file is always created as packages/metadata.db regardless of what --storage path was specified.

Using the STORAGE environment places the metadata file into the specified directory.

The reason is that the database options definition uses the default_storage path, which will default to packages unless STORAGE is set, but since the options aren't parsed yet, the --storage value is ignored.

As a user, this is a little surprising -- I'd expected STORAGE and --storage to have the same effect.

I think the best solution would be to defer constructing the database URL until after options parsing, in server.py?