Files
glpi-airwatch-sync/scripts/functions.py

48 lines
1.2 KiB
Python

import os
import toml
def getSettings(settingsPath):
settingsDefault ="""
[AIRWATCH]
Server = "https://airwatchServer"
ConsoleURI = "https://airwatchConsole"
APIKey = "APIKEY"
# Méthode d'authentification (CMSURL or PASSWORD)
# CMSURL permet l'authentification avec un certificat utilisateur
# PASSWORD permet l'authentification avec un nom d'utilisateur et un mot de passe (APIUser, APIPassword)
AuthenticationMethod = "CMSURL"
CertificatePath = "/path/to/cert"
CertificatePassword = "12345"
APIUser = "UserAPI"
APIPassword = "PasswordUserAPI"
# Utilisateur de staging que l'on va remplacer par l'utilisateur trouvé dans GLPI
StagingUser = "staging-pr"
[GLPI]
Server = "http://127.0.0.1/glpi"
AppToken = "GLPIAppToken"
UserToken = "GLPIUserToken"
# User agent qui sera visible sur GLPI lors de la synchronisation
UserAgent = "Airwatch Synchronizer"
[LOGS]
Enabled = true
# Chemin où seront créé les fichiers de log
Path = "./logs/"
# Mode debug pour avoir plus d'informations
Debug = false
"""
settings = None
if(not os.path.isfile(settingsPath)):
f = open(settingsPath, "w")
f.write(settingsDefault)
f.close()
with open(settingsPath, "r") as f:
settings = toml.load(f)
return settings