-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issues from SECRET_KEY_LOAD_AND_STORE and settings reorganization (
#676) #668 added a new `SECRET_KEY_LOAD_AND_STORE` boolean setting in the backend. If `SECRET_KEY_LOAD_AND_STORE` is false, then the `SECRET_KEY` is generated at startup and not stored. If it is true, the program tries reading it from `SECRET_KEY_PATH`, and if that fails generate a new one and write it there. The intent was to allow configuring components that use the same settings as the backend server not to write the `SECRET_KEY` on the file system, because this eases configuration in production. In #668 this was set to `False` by default. However to match the pre-668 behavior you'd need to set it to `True` by default. Possibly we could get rid of this setting instead and just write the key every time. I don't know _why_ frontend authentication on k8s breaks when this setting is set to `false`. The `SECRET_KEY` is used for signing JWTs, so presumably at some point Django is restarted and so previously generated JWTs aren't valid anymore.. But JWTs are requested (and therefore generated) right before they're needed, so that's weird. --- #668 also moved the file containing this line: ```python BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) ``` without updating it, which broke paths Co-authored-by: Guilhem Barthés <guilhem.barthes@owkin.com> Signed-off-by: Olivier Léobal <olivier.leobal@owkin.com>
- Loading branch information
1 parent
0734f72
commit ab5d604
Showing
6 changed files
with
16 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
import os | ||
import sys | ||
from pathlib import Path | ||
|
||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) | ||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
PROJECT_ROOT = os.path.dirname(BASE_DIR) | ||
BASE_DIR: Path = Path(__file__).resolve().parents[2] | ||
PROJECT_ROOT = BASE_DIR.parent | ||
|
||
sys.path.append(PROJECT_ROOT) | ||
sys.path.append(os.path.normpath(os.path.join(PROJECT_ROOT, "libs"))) | ||
sys.path.append(str(PROJECT_ROOT)) | ||
sys.path.append(str(PROJECT_ROOT / "libs")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters