From 39541f50d9fb19035ac4df9bdba686be69ce0877 Mon Sep 17 00:00:00 2001 From: pedro Date: Wed, 24 Jan 2024 14:41:06 +0100 Subject: [PATCH] docker: code that facilitates deploy of pilots - new env var SYNC_ORG_DEV (which is by default 'y'); useful for idhub devs - new env var ORG_FILE; useful in docker to specify org examples file per pilot - add all examples files for each org in pilot that needs it --- examples/organizations__pilot_pangea.csv | 2 ++ examples/organizations__pilot_setem.csv | 2 ++ examples/organizations__pilot_xo9b.csv | 3 +++ idhub/management/commands/initial_datas.py | 7 ++++--- trustchain_idhub/settings.py | 2 ++ 5 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 examples/organizations__pilot_pangea.csv create mode 100644 examples/organizations__pilot_setem.csv create mode 100644 examples/organizations__pilot_xo9b.csv diff --git a/examples/organizations__pilot_pangea.csv b/examples/organizations__pilot_pangea.csv new file mode 100644 index 0000000..ecaf055 --- /dev/null +++ b/examples/organizations__pilot_pangea.csv @@ -0,0 +1,2 @@ +"pangea.org";"https://idhub1.demo.pangea.org/oidc4vp/" +"exo.cat";"https://idhub2.demo.pangea.org/oidc4vp/" diff --git a/examples/organizations__pilot_setem.csv b/examples/organizations__pilot_setem.csv new file mode 100644 index 0000000..92a2775 --- /dev/null +++ b/examples/organizations__pilot_setem.csv @@ -0,0 +1,2 @@ +"Setem Madrid";"https://idhub1-setem.demo.pangea.org/oidc4vp/" +"Setem Catalunya";"https://idhub2-setem.demo.pangea.org/oidc4vp/" diff --git a/examples/organizations__pilot_xo9b.csv b/examples/organizations__pilot_xo9b.csv new file mode 100644 index 0000000..b7af014 --- /dev/null +++ b/examples/organizations__pilot_xo9b.csv @@ -0,0 +1,3 @@ +"Xarxa Oberta de Nou Barris (XO9B)";"https://idhub1-xo9b.demo.pangea.org/oidc4vp/" +"somconnexio.coop";"https://idhub2-xo9b.demo.pangea.org/oidc4vp/" +"exo.cat";"https://verify.exo.cat" diff --git a/idhub/management/commands/initial_datas.py b/idhub/management/commands/initial_datas.py index e889cb7..69c1ef5 100644 --- a/idhub/management/commands/initial_datas.py +++ b/idhub/management/commands/initial_datas.py @@ -30,13 +30,14 @@ class Command(BaseCommand): self.create_users(USER_EMAIL, USER_PASSWORD) BASE_DIR = Path(__file__).resolve().parent.parent.parent.parent - ORGANIZATION = os.path.join(BASE_DIR, 'examples/organizations.csv') + ORGANIZATION = os.path.join(BASE_DIR, settings.ORG_FILE) with open(ORGANIZATION, newline='\n') as csvfile: f = csv.reader(csvfile, delimiter=';', quotechar='"') for r in f: self.create_organizations(r[0].strip(), r[1].strip()) - self.sync_credentials_organizations("pangea.org", "somconnexio.coop") - self.sync_credentials_organizations("local 8000", "local 9000") + if settings.SYNC_ORG_DEV == 'y': + self.sync_credentials_organizations("pangea.org", "somconnexio.coop") + self.sync_credentials_organizations("local 8000", "local 9000") self.create_schemas() def create_admin_users(self, email, password): diff --git a/trustchain_idhub/settings.py b/trustchain_idhub/settings.py index afc3169..6ab3b83 100644 --- a/trustchain_idhub/settings.py +++ b/trustchain_idhub/settings.py @@ -224,3 +224,5 @@ LOGGING = { } ORGANIZATION = config('ORGANIZATION', 'Pangea') +SYNC_ORG_DEV = config('SYNC_ORG_DEV', 'y') +ORG_FILE = config('ORG_FILE', 'examples/organizations.csv')