20 |
20 |
ead = EadKeyParser()
|
21 |
21 |
ead.parse_file(join(CONFIG_DIR, FRONTEND_KEYS_FILE))
|
22 |
22 |
ead_keys = ead.get_key_dict()
|
23 |
|
if ead_keys != {}:
|
24 |
|
# des frontend sont déjà enregistrés
|
|
23 |
if "127.0.0.1" in ead_keys:
|
25 |
24 |
# Remplacement de 127.0.0.1 avec le nom complet DNS (valide dans le certif SSL)
|
26 |
|
if "127.0.0.1" in ead_keys:
|
27 |
|
toRm = ''
|
28 |
|
srvLst = servers().get_server()
|
29 |
|
for key,value in srvLst.items():
|
30 |
|
if value[0] == 'https://127.0.0.1':
|
31 |
|
servers().del_server(key)
|
32 |
|
else:
|
33 |
|
return
|
34 |
|
key = create_magicnb('admin', 'admin')
|
35 |
|
dic = { nom_domaine: key }
|
36 |
|
# ecriture clé ead-serveur
|
37 |
|
ead.write_file(join(CONFIG_DIR, FRONTEND_KEYS_FILE), dic)
|
38 |
|
# ecriture clé ead-web
|
39 |
|
servers().add_server('https://{0}'.format(nom_domaine),
|
40 |
|
str(BACKEND_LISTEN_PORT),
|
41 |
|
nom_machine,
|
42 |
|
str(key))
|
|
25 |
srvLst = servers().get_server()
|
|
26 |
for key, value in srvLst.items():
|
|
27 |
if value[0] == 'https://127.0.0.1':
|
|
28 |
servers().del_server(key)
|
|
29 |
break
|
|
30 |
if nom_domaine not in ead_keys:
|
|
31 |
key = create_magicnb('admin', 'admin')
|
|
32 |
dic = {nom_domaine: key}
|
|
33 |
# ecriture clé ead-serveur
|
|
34 |
ead.write_file(join(CONFIG_DIR, FRONTEND_KEYS_FILE), dic)
|
|
35 |
# ecriture clé ead-web
|
|
36 |
servers().add_server('https://{0}'.format(nom_domaine),
|
|
37 |
str(BACKEND_LISTEN_PORT),
|
|
38 |
nom_machine,
|
|
39 |
str(key))
|
43 |
40 |
|
44 |
41 |
register_ead()
|