diff --git a/agent/proxysql.py b/agent/proxysql.py index 077469ad..c03015ff 100644 --- a/agent/proxysql.py +++ b/agent/proxysql.py @@ -25,9 +25,16 @@ def proxysql_execute(self, command): return self.execute(command) @job("Add User to ProxySQL") - def add_user_job(self, username, password, database, backend): + def add_user_job( + self, + username: str, + password: str, + database: str, + max_connections: int, + backend: dict, + ): self.add_backend(backend) - self.add_user(username, password, database, backend) + self.add_user(username, password, database, max_connections, backend) @job("Add Backend to ProxySQL") def add_backend_job(self, backend): @@ -48,7 +55,7 @@ def add_backend(self, backend): self.proxysql_execute(command) @step("Add User to ProxySQL") - def add_user(self, username, password, database, backend): + def add_user(self, username: str, password: str, database: str, max_connections: int, backend: dict): backend_id = backend["id"] commands = [ ( @@ -57,7 +64,7 @@ def add_user(self, username, password, database, backend): "use_ssl, max_connections) " "VALUES ( " f'"{username}", "{password}", {backend_id}, "{database}", ' - "1, 16)" + f"1, {max_connections})" ), "LOAD MYSQL USERS TO RUNTIME", "SAVE MYSQL USERS FROM RUNTIME", diff --git a/agent/web.py b/agent/web.py index 28264039..aa114633 100644 --- a/agent/web.py +++ b/agent/web.py @@ -1036,6 +1036,7 @@ def proxysql_add_user(): data["username"], data["password"], data["database"], + data["max_connections"], data["backend"], ) return {"job": job}