lifecycle: only create tenant media root if needed (#10616) Co-authored-by: Jens L. <jens@goauthentik.io>
This commit is contained in:
![98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
GitHub

parent
0a9595089e
commit
b23972e9c9
@ -1,6 +1,7 @@
|
||||
# flake8: noqa
|
||||
from pathlib import Path
|
||||
|
||||
from authentik.lib.config import CONFIG
|
||||
from lifecycle.migrate import BaseMigration
|
||||
|
||||
MEDIA_ROOT = Path(__file__).parent.parent.parent / "media"
|
||||
@ -9,7 +10,9 @@ TENANT_MEDIA_ROOT = MEDIA_ROOT / "public"
|
||||
|
||||
class Migration(BaseMigration):
|
||||
def needs_migration(self) -> bool:
|
||||
return not TENANT_MEDIA_ROOT.exists()
|
||||
return (
|
||||
not TENANT_MEDIA_ROOT.exists() and CONFIG.get("storage.media.backend", "file") != "s3"
|
||||
)
|
||||
|
||||
def run(self):
|
||||
TENANT_MEDIA_ROOT.mkdir(parents=True)
|
||||
|
Reference in New Issue
Block a user