Question
· Sep 6, 2018

Programmatic access to CSP Server Access

Is there a way to modify the CSP Server Access settings programmatically, instead of through the management portal?

Discussion (5)0
Log in or sign up to continue

Yes.

USER>set reg = $system.CSP.GetGatewayRegistry()

USER>set managers = reg.GetGatewayMgrs("a")

USER>write managers.Size // you can have many CSP Gateways connected to this Caché instance
1
USER>set mgr = managers.GetAt(1) // I only have one

USER>write mgr.GetThisServerName(.names)
1
USER>zwrite names // this server is listed in CSP Gateway Configuration as 'LOCAL'.
names(0)="LOCAL"
USER>kill params

USER>set params("Username")="CSPSystem"

USER>set params("Password")="very strong password"

USER>write mgr.SetServerParams("LOCAL",.params)
1

USER>write mgr.CloseConnections("LOCAL") // close connections, forcing to reconnect with new credentials.
1

Please be careful, if username/password are not valid for connection to Caché, then CSP Gateway will not be able to reconnect, and you'll loose connection with CSP Gateway and ability to modify settings using this API.

For more details see
1. https://docs.intersystems.com/latest/csp/docbook/DocBook.UI.Page.cls?KEY...
2. Class reference for classes in package %CSP.Mgr