Updating README with Environment Variable information.
irisconns was created to help manage IRIS connections in your project using configuration files instead of hard-coding the configuration information in your project. Any missing information (such as username, password) will be prompted by the user’s terminal.
irisconns looks in irisconns or .irisconns files for connection information.
If a connection has been previously requested, the new request will immediately return the existing connection without prompting the user.
The environment variable CONN can also be used to change the default connection settings for irisconns. Set CONN to a valid connection name, and irisconns will attempt to open the specified connection by default.
irisconns was originally created/published for the InterSystems External Languages Contest: .Net, Java, Python, JavaScript - 2025.
irisconns looks in the following directories:
In each directory, irisconns looks for the following files:
irisconns.irisconnsThe first file that contains a section for the given connection name will be loaded. Any missing information will be gathered by prompting the user for more information.
# 'default' is the connection returned if no name is provided. [default] hostname = localhost port = 11972 namespace = USER username = _SYSTEMThis connection name is "TEST".
[TEST]
hostname = test-server
port = 1972
namespace = USER
username = _SYSTEM
confirm = falseThis connection name is "PROD".
[PROD]
hostname = prod-server
port = 1972
namespace = %SYS
username = _SYSTEM
The following keys can be set for each connection in an irisconns file. Any missing/required keys will be prompted to the user.
| Key | Description | Example Values |
|---|---|---|
| hostname | Server name/IP of the connection | |
| port | Port number for the connection | |
| namespace | Namespace being connected to | |
| username | User name | |
| confirm | Should we confirm passwords? | false, no, off, f, n, 0, true, yes, on, t, y, 1 |
If you set the CONN environment variable to a valid connection name, irisconns will try to use that name, by default.
For instance, if CONN is not set, irisconns will look for a configuration named default in all of the found irisconns (and .irisconns) files. If CONN=PROD, irisconns would look for a configuration named PROD when no explicit configuration name if passed in the code.
# Python Environment Variable Example: # shell> CONN="TEST" python3 test.pyThis looks for a configuration named 'default', unless 'CONN' is set.
If CONN="TEST", this looks for a 'TEST' configuration.
irispy = irisconns.get_irispy()
This call to get_irispy will always look for a configuration named 'PROD',
no matter what 'CONN' is set to.
irispy = irisconns.get_irispy('PROD')
// JavaScript Environment Variable Example:
// shell> CONN="TEST" node test.js
// This looks for a configuration named 'default', unless 'CONN' is set.
// If CONN="TEST", this looks for a 'TEST' configuration.
const iris = await irisconns.get_iris();
// This call to get_iris will always look for a configuration named 'PROD',
// no matter what 'CONN' is set to.
const iris = await irisconns.get_iris('PROD');
Save irisconns.py to your PYTHONPATH so that you can import the irisconns module.
This module requires the IRIS Python SDK:
pip install intersystems-irispython
Example usage:
import irisconnsdefault connection
irispy = irisconns.get_irispy()
named connection
irispy = irisconns.get_irispy('TEST')
usage
irispy.set('hello world!', 'test', 1)
print(f'>>> Value from IRIS: {irispy.get("test", 1)}')
irispy.kill('test', 1)
Save irisconns.js to your project so that you can require the irisconns.js package.
This module requires the IRIS JavaScript SDK:
npm install @intersystems/intersystems-iris-native
Example usage:
// Import the package const irisconns = require('./irisconns.js');// Wrap in an async function so we can await the connection...
(async () => {
// 'default' connection
const iris = await irisconns.get_iris();// named (i.e. "PROD") connection
// const iris = await irisconns.get_iris('PROD');
// usage
iris.set('hello world!','test',1);
console.log('>>> Value from IRIS: ', iris.get('test',1));
iris.kill('test',1);
})()
To demo irisconns, run the following docker compose command to start up a generic IRIS instance and build the demo images:
docker compose up
To run the python demo:
docker run -it --rm --network irisconns_default irisconns-irispy python demo.py
To run the nodejs demo:
docker run -it --rm --network irisconns_default irisconns-irisjs node demo.js