-
Notifications
You must be signed in to change notification settings - Fork 14
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
Ajout d'une migration pour remplir les bases vide #473
Conversation
Ça va être la merdasse pour redéployer |
@mock.patch.dict(os.environ, {"INIT_ORGA_NAME": "Donjons et Siphons"}) | ||
@mock.patch.dict(os.environ, {"INIT_ADMIN_USERNAME": "mario.brossse@world.fr"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hahaha :D
@mock.patch.dict(os.environ, {"INIT_ORGA_NAME": "Donjons et Siphons"}) | ||
@mock.patch.dict(os.environ, {"INIT_ADMIN_USERNAME": "mario.brossse@world.fr"}) | ||
@mock.patch.dict(os.environ, {"INIT_ADMIN_PASSWORD": "PEACHforEVER"}) | ||
@mock.patch.dict(os.environ, {"INIT_TOKEN": "12345"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mock.patch.dict(os.environ, {"INIT_TOKEN": "12345"}) | |
@mock.patch.dict(os.environ, {"INIT_TOKEN": "123456"}) |
Six chiffres le token, sinon tu vas avoir des problèmes
init_token = os.environ.get("INIT_TOKEN", None) | ||
|
||
models = [Aidant, Organisation, StaticToken, StaticDevice] | ||
if any([model.objects.exists() for model in models]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any()
❤️
Python ❤️
if any([model.objects.exists() for model in models]): | ||
return None | ||
|
||
if all([init_token, init_orga_name, init_admin_username, init_admin_password]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all()
❤️
88b2e13
to
42a7535
Compare
|
||
dependencies = [ | ||
("aidants_connect_web", "0078_auto_20211122_1813"), | ||
("otp_static", "__latest__"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wah… Je connaissais pas __latest__
. C'top bien !
42a7535
to
61a1b87
Compare
61a1b87
to
3adf520
Compare
🌮 Objectif
On ajoute une migration qui remplie les bases vide avec une orga, un user et un token statique uniquement si les conditions suivantes sont respectées :
j'ai presque envie que l'on ne merge jamais cette PR et qu'on déploie simplement une fois la branche lorsque nécessaire.
🔍 Implémentation
🏕 Amélioration continue
(optionnel) Documentation, commandes à lancer, variables d'environment, etc
🖼️ Images
(optionnel) Une ou plusieurs captures d'écran