bepasty-server icon indicating copy to clipboard operation
bepasty-server copied to clipboard

Use module instead of class for flask configuration

Open augustfengd opened this issue 3 years ago • 6 comments

Flask supports module as objects for configuration abilities.

This will allow easier user overrides as they won't need to manipulate the class into a data configuration file.

Also added a bit of refactoring to change Config -> settings.

settings seems to be the preferred technical term in the documentations.

https://flask.palletsprojects.com/en/2.0.x/config/#configuring-from-python-files

augustfengd avatar Jun 27 '21 00:06 augustfengd

Codecov Report

Merging #275 (0723957) into master (c40d55d) will decrease coverage by 0.53%. The diff coverage is 58.06%.

:exclamation: Current head 0723957 differs from pull request most recent head ffc0c20. Consider uploading reports for the commit ffc0c20 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master     #275      +/-   ##
==========================================
- Coverage   71.38%   70.84%   -0.54%     
==========================================
  Files          44       44              
  Lines        2558     2593      +35     
==========================================
+ Hits         1826     1837      +11     
- Misses        732      756      +24     
Impacted Files Coverage Δ
src/bepasty/cli/object.py 0.00% <0.00%> (ø)
src/bepasty/cli/server.py 0.00% <ø> (ø)
src/bepasty/tests/screenshots.py 0.00% <0.00%> (ø)
src/bepasty/utils/formatters.py 15.15% <0.00%> (ø)
src/bepasty/views/display.py 16.83% <0.00%> (ø)
src/bepasty/views/upload.py 20.95% <0.00%> (ø)
src/bepasty/wsgi.py 0.00% <ø> (ø)
src/bepasty/views/download.py 59.13% <32.50%> (-19.05%) :arrow_down:
src/bepasty/storage/filesystem/__init__.py 91.81% <66.66%> (-0.08%) :arrow_down:
src/bepasty/utils/date_funcs.py 93.33% <66.66%> (ø)
... and 12 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8f4c23f...ffc0c20. Read the comment docs.

codecov-commenter avatar Jun 27 '21 15:06 codecov-commenter

"Here are the configuration defaults:" (note: singular configuration)

Also please edit conf.py and add add_module_names = False.

ThomasWaldmann avatar Jun 29 '21 21:06 ThomasWaldmann

"Here are the configuration defaults:" (note: singular configuration)

Also please edit conf.py and add add_module_names = False.

My bad, I wasn't paying attention to the plural forms. I just made the requested modifications.

augustfengd avatar Jun 29 '21 21:06 augustfengd

OK, looks good now! Thanks.

ThomasWaldmann avatar Jun 29 '21 22:06 ThomasWaldmann

Assigned this to release 2.0.0 milestone because it is a breaking change and people need to edit their configs to keep it working.

So guess I'll make a 1.1.0 release first as soon as that milestone is completed, then merge this PR and then later release it as 2.0.0 (maybe together with more [breaking?] changes).

ThomasWaldmann avatar Jun 29 '21 22:06 ThomasWaldmann

OK, looks good now! Thanks.

Assigned this to release 2.0.0 milestone because it is a breaking change and people need to edit their configs to keep it working.

So guess I'll make a 1.1.0 release first as soon as that milestone is completed, then merge this PR and then later release it as 2.0.0 (maybe together with more [breaking?] changes).

:) thanks for your patience and opinions during the review process.

augustfengd avatar Jul 02 '21 01:07 augustfengd

@augustfengd Hmm, why did you delete this?

ThomasWaldmann avatar Feb 24 '24 01:02 ThomasWaldmann

Hey @ThomasWaldmann! I was cleaning up some inactive repositories that I owned. It must've closed this pull request.

augustfengd avatar Feb 24 '24 16:02 augustfengd

See #323.

ThomasWaldmann avatar Feb 24 '24 16:02 ThomasWaldmann