|
23 | 23 | from jans.pycloudlib.persistence import SqlClient
|
24 | 24 | from jans.pycloudlib.persistence import doc_id_from_dn
|
25 | 25 | from jans.pycloudlib.persistence import id_from_dn
|
| 26 | +from jans.pycloudlib.persistence.utils import PersistenceMapper |
26 | 27 | from jans.pycloudlib.utils import cert_to_truststore
|
27 | 28 | from jans.pycloudlib.utils import get_random_chars
|
28 | 29 | from jans.pycloudlib.utils import encode_text
|
@@ -141,33 +142,36 @@ def main():
|
141 | 142 | render_salt(manager, "/app/templates/salt.tmpl", "/etc/jans/conf/salt")
|
142 | 143 | render_base_properties("/app/templates/jans.properties.tmpl", "/etc/jans/conf/jans.properties")
|
143 | 144 |
|
144 |
| - if persistence_type in ("ldap", "hybrid"): |
| 145 | + mapper = PersistenceMapper() |
| 146 | + persistence_groups = mapper.groups() |
| 147 | + |
| 148 | + if persistence_type == "hybrid": |
| 149 | + render_hybrid_properties("/etc/jans/conf/jans-hybrid.properties") |
| 150 | + |
| 151 | + if "ldap" in persistence_groups: |
145 | 152 | render_ldap_properties(
|
146 | 153 | manager,
|
147 | 154 | "/app/templates/jans-ldap.properties.tmpl",
|
148 | 155 | "/etc/jans/conf/jans-ldap.properties",
|
149 | 156 | )
|
150 | 157 | sync_ldap_truststore(manager)
|
151 | 158 |
|
152 |
| - if persistence_type in ("couchbase", "hybrid"): |
| 159 | + if "couchbase" in persistence_groups: |
153 | 160 | render_couchbase_properties(
|
154 | 161 | manager,
|
155 | 162 | "/app/templates/jans-couchbase.properties.tmpl",
|
156 | 163 | "/etc/jans/conf/jans-couchbase.properties",
|
157 | 164 | )
|
158 | 165 | sync_couchbase_truststore(manager)
|
159 | 166 |
|
160 |
| - if persistence_type == "hybrid": |
161 |
| - render_hybrid_properties("/etc/jans/conf/jans-hybrid.properties") |
162 |
| - |
163 |
| - if persistence_type == "sql": |
| 167 | + if "sql" in persistence_groups: |
164 | 168 | render_sql_properties(
|
165 | 169 | manager,
|
166 | 170 | "/app/templates/jans-sql.properties.tmpl",
|
167 | 171 | "/etc/jans/conf/jans-sql.properties",
|
168 | 172 | )
|
169 | 173 |
|
170 |
| - if persistence_type == "spanner": |
| 174 | + if "spanner" in persistence_groups: |
171 | 175 | render_spanner_properties(
|
172 | 176 | manager,
|
173 | 177 | "/app/templates/jans-spanner.properties.tmpl",
|
@@ -204,16 +208,8 @@ def __init__(self, manager):
|
204 | 208 | }
|
205 | 209 |
|
206 | 210 | # determine persistence type
|
207 |
| - self.persistence_type = os.environ.get("CN_PERSISTENCE_TYPE", "ldap") |
208 |
| - ldap_mapping = os.environ.get("CN_PERSISTENCE_LDAP_MAPPING", "default") |
209 |
| - |
210 |
| - if self.persistence_type == "hybrid": |
211 |
| - if ldap_mapping == "default": |
212 |
| - client_cls = LdapClient |
213 |
| - self.persistence_type = "ldap" |
214 |
| - else: |
215 |
| - client_cls = CouchbaseClient |
216 |
| - self.persistence_type = "couchbase" |
| 211 | + mapper = PersistenceMapper() |
| 212 | + self.persistence_type = mapper.mapping["default"] |
217 | 213 |
|
218 | 214 | # determine persistence client
|
219 | 215 | client_cls = client_classes.get(self.persistence_type)
|
|
0 commit comments