locust-cloud 1.5.5__py3-none-any.whl → 1.5.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
locust_cloud/__init__.py CHANGED
@@ -21,6 +21,7 @@ PG_PASSWORD = os.environ.get("PG_PASSWORD")
21
21
  PG_DATABASE = os.environ.get("PG_DATABASE")
22
22
  PG_PORT = os.environ.get("PG_PORT", 5432)
23
23
  GRAPH_VIEWER = os.environ.get("GRAPH_VIEWER")
24
+ MAX_USER_COUNT = os.environ.get("MAX_USER_COUNT")
24
25
  logger = logging.getLogger(__name__)
25
26
 
26
27
 
@@ -78,9 +79,6 @@ def on_locust_init(environment: locust.env.Environment, **_args):
78
79
  if not (PG_HOST and PG_USER and PG_PASSWORD and PG_DATABASE and PG_PORT):
79
80
  return
80
81
 
81
- if GRAPH_VIEWER:
82
- environment.web_ui.template_args["isGraphViewer"] = True
83
-
84
82
  try:
85
83
  pool = create_connection_pool(
86
84
  pg_user=PG_USER,
@@ -99,5 +97,10 @@ def on_locust_init(environment: locust.env.Environment, **_args):
99
97
  Exporter(environment, pool)
100
98
 
101
99
  if environment.web_ui:
100
+ environment.web_ui.template_args["maxUserCount"] = MAX_USER_COUNT
101
+
102
+ if GRAPH_VIEWER:
103
+ environment.web_ui.template_args["isGraphViewer"] = True
104
+
102
105
  register_auth(environment)
103
106
  register_query(environment, pool)
locust_cloud/auth.py CHANGED
@@ -7,6 +7,11 @@ import requests
7
7
  import werkzeug
8
8
  from flask import redirect, request, url_for
9
9
  from flask_login import UserMixin, login_user
10
+ from locust_cloud.constants import (
11
+ DEFAULT_DEPLOYER_URL,
12
+ )
13
+
14
+ DEPLOYER_URL = os.environ.get("LOCUSTCLOUD_DEPLOYER_URL", DEFAULT_DEPLOYER_URL)
10
15
 
11
16
 
12
17
  class Credentials(TypedDict):
@@ -62,7 +67,7 @@ def register_auth(environment: locust.env.Environment):
62
67
 
63
68
  try:
64
69
  auth_response = requests.post(
65
- f"{environment.parsed_options.deployer_url}/auth/login",
70
+ f"{DEPLOYER_URL}/auth/login",
66
71
  json={"username": username, "password": password},
67
72
  )
68
73