Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[server] isso/init: Log paths at start, error if not found; ISSO_SETTINGS takes precedence over -c flag #854

Merged
merged 2 commits into from
May 5, 2022

Conversation

ix5
Copy link
Member

@ix5 ix5 commented May 1, 2022

isso/init: Log paths at start, error if not found

Fixes #585

isso/init: ISSO_SETTINGS takes precedence over -c

This restores the behavior as was documented in the server config docs, i.e. makes it possible to use ISSO_SETTINGS=share/isso-dev.cfg isso run.
This used to fail as ISSO_SETTINGS was only read by WSGI invocations of isso.dispatch or isso.run


Ping @jwatt

@ix5 ix5 added server (Python) server code improvement Not a new feature, but makes Isso more pleasant to use labels May 1, 2022
@ix5 ix5 added this to the 0.13 milestone May 1, 2022
@ix5 ix5 marked this pull request as draft May 1, 2022 13:07
@ix5 ix5 marked this pull request as ready for review May 1, 2022 13:45
@ix5
Copy link
Member Author

ix5 commented May 1, 2022

Tested with:

Plain isso

$ isso -c share/isso-dev.cfg run

2022-05-01 15:54:55,248 INFO: Using configuration file '/home/user/isso/isso/share/isso-dev.cfg'
2022-05-01 15:54:55,260 INFO: Using database at '/home/user/isso/isso/comments.db'

-> works

$ ISSO_SETTINGS=share/isso-dev.cfg isso run

2022-05-05 23:13:08,039 INFO: Using configuration file '/home/user/isso/share/isso-dev.cfg'
2022-05-05 23:13:08,051 INFO: Using database at '/home/user/isso/comments.db'

-> does not work (env var is only read for multiple-sites setup via isso.dispatch/isso.run)

-> Now works, since ISSO_SETTINGS is read and takes precedence.

gunicorn

$ ISSO_SETTINGS=share/isso-dev.cfg gunicorn -b 0.0.0.0:8080 isso.run

[2022-05-01 15:53:38 +0200] [24971] [INFO] Starting gunicorn 20.1.0
[2022-05-01 15:53:38 +0200] [24971] [INFO] Listening at: http://0.0.0.0:8080 (24971)
[2022-05-01 15:53:38 +0200] [24971] [INFO] Using worker: sync
[2022-05-01 15:53:38 +0200] [24972] [INFO] Booting worker with pid: 24972
2022-05-01 15:53:38,834 INFO: Using database at '/home/user/isso/isso/comments.db'

-> works (Note: isso/run.py contains no check for non-existent configs)

Multiple sites

$ ISSO_SETTINGS=share/isso-dev.cfg gunicorn -b 0.0.0.0:8080 isso.dispatch

[2022-05-01 15:55:29 +0200] [25135] [INFO] Starting gunicorn 20.1.0
[2022-05-01 15:55:29 +0200] [25135] [INFO] Listening at: http://0.0.0.0:8080 (25135)
[2022-05-01 15:55:29 +0200] [25135] [INFO] Using worker: sync
[2022-05-01 15:55:29 +0200] [25136] [INFO] Booting worker with pid: 25136
2022-05-01 15:55:29,887 INFO: Using database at '/home/user/isso/isso/comments.db'

with name = foo inserted into isso-dev.cfg

@ix5 ix5 force-pushed the startup-logging branch 2 times, most recently from ce97332 to 6680858 Compare May 5, 2022 21:12
ix5 added 2 commits May 5, 2022 23:16
This restores the behavior as was documented in the server
config docs, i.e. makes it possible to use
`ISSO_SETTINGS=share/isso-dev.cfg isso run`.
This used to fail as `ISSO_SETTINGS` was only read by WSGI
invocations of `isso.dispatch` or `isso.run`
@ix5 ix5 force-pushed the startup-logging branch from 6680858 to 9985ebd Compare May 5, 2022 21:16
@ix5 ix5 changed the title [server] isso/init: Log paths at start, error if not found [server] isso/init: Log paths at start, error if not found; ISSO_SETTINGS takes precedence over -c flag May 5, 2022
@ix5 ix5 merged commit bb4620b into isso-comments:master May 5, 2022
@ix5 ix5 deleted the startup-logging branch May 5, 2022 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Not a new feature, but makes Isso more pleasant to use server (Python) server code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When Isso starts, log the path of the database and of the config file
1 participant