Config Env / Phases

This commit is contained in:
2025-12-15 00:00:22 +01:00
parent ef174f3276
commit b3b91ad1d8

View File

@@ -28,9 +28,17 @@ from rich.console import Console
# CONFIGURATION - CREDENTIALS # CONFIGURATION - CREDENTIALS
# ============================================================================ # ============================================================================
DEFAULT_USER_NAME = "admin" ENV = "pre-prod" # "prod" or "pre-prod"
DEFAULT_PASSWORD = "+J3/rw..'ynxXDHwt?bAvn_>" if "prod" in sys.argv:
REALME = "ziwig-pro" ENV = "prod"
sys.argv.remove("prod")
elif "pre-prod" in sys.argv:
ENV = "pre-prod"
sys.argv.remove("pre-prod")
DEFAULT_USER_NAME = "admin" if ENV == "prod" else "admin"
DEFAULT_PASSWORD = "+J3/rw..'ynxXDHwt?bAvn_>" if ENV == "prod" else "123@Admin"
REALME = "ziwig-pro" if ENV == "prod" else "ziwig-pro"
# ============================================================================ # ============================================================================
@@ -41,7 +49,7 @@ REALME = "ziwig-pro"
MICROSERVICES = { MICROSERVICES = {
"IAM": { "IAM": {
"app_id": None, # IAM doesn't use app_id "app_id": None, # IAM doesn't use app_id
"base_url": "https://api-auth.ziwig-connect.com", "base_url": "https://api-auth.ziwig-connect.com" if ENV == "prod" else "https://api-iam.pp.ziwig-platform.com", # PRE-PROD
"endpoints": { "endpoints": {
"login": "/api/auth/{REALME}/login", # POST : Body = {"username": "{user_name}", "password": "{pass}"} "login": "/api/auth/{REALME}/login", # POST : Body = {"username": "{user_name}", "password": "{pass}"}
"refresh": "/api/auth/refreshToken", # POST : Body = {"refresh_token": "{refresh_token}"} "refresh": "/api/auth/refreshToken", # POST : Body = {"refresh_token": "{refresh_token}"}
@@ -75,8 +83,8 @@ MICROSERVICES = {
# } # }
# }, # },
"HRD": { "HRD": {
"app_id": "93bc44fd-c64b-4fff-a450-f3cba956e934", "app_id": "93bc44fd-c64b-4fff-a450-f3cba956e934" if ENV == "prod" else "234d72f1-509a-4e99-b2b9-ee12da1e336d",
"base_url": "https://api-resources.ziwig-connect.com", "base_url": "https://api-resources.ziwig-connect.com" if ENV == "prod" else "https://api-hrd.pp.ziwig-platform.com",
"endpoints": { "endpoints": {
"config_token": "/api/auth/config-token", # POST : Body = {"userId": "{user_id}", "clientId": "{app_id}", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"}} "config_token": "/api/auth/config-token", # POST : Body = {"userId": "{user_id}", "clientId": "{app_id}", "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"}}
"refresh": "/api/auth/refreshToken", # POST : Body = {"refresh_token": "{refresh_token}"} "refresh": "/api/auth/refreshToken", # POST : Body = {"refresh_token": "{refresh_token}"}
@@ -773,6 +781,19 @@ def main():
""" """
global main_thread_pool, subtasks_thread_pool, number_of_threads global main_thread_pool, subtasks_thread_pool, number_of_threads
phase1 = True
phase2 = True
phase3 = True
if len(sys.argv) > 1:
if "1" not in sys.argv:
phase1 = False
if "2" not in sys.argv:
phase2 = False
if "3" not in sys.argv:
phase3 = False
# ========== AUTHENTICATION ========== # ========== AUTHENTICATION ==========
print() print()
login_status = login() login_status = login()
@@ -786,7 +807,7 @@ def main():
number_of_threads = int( number_of_threads = int(
questionary.text( questionary.text(
"Number of threads:", "Number of threads:",
default="12", default="5",
validate=lambda x: x.isdigit() and 0 < int(x) <= MAX_THREADS validate=lambda x: x.isdigit() and 0 < int(x) <= MAX_THREADS
).ask() ).ask()
) )
@@ -799,6 +820,7 @@ def main():
init_subtasks_pool() init_subtasks_pool()
# ========== PHASE 1: ROLES ========== # ========== PHASE 1: ROLES ==========
if phase1:
print() print()
console.print("==================================================") console.print("==================================================")
console.print("[bold cyan]PHASE 1: Processing Roles[/bold cyan]") console.print("[bold cyan]PHASE 1: Processing Roles[/bold cyan]")
@@ -831,6 +853,7 @@ def main():
# ========== PHASE 2: APPLICATIONS ========== # ========== PHASE 2: APPLICATIONS ==========
if phase2:
print() print()
console.print("==================================================") console.print("==================================================")
console.print("[bold cyan]PHASE 2: Processing Applications[/bold cyan]") console.print("[bold cyan]PHASE 2: Processing Applications[/bold cyan]")
@@ -892,6 +915,7 @@ def main():
# ========== PHASE 3: ENDOBEST CENTERS ========== # ========== PHASE 3: ENDOBEST CENTERS ==========
if phase3:
process_endobest_centers() process_endobest_centers()