-
Notifications
You must be signed in to change notification settings - Fork 5
client_params
Sudheer edited this page Jan 25, 2023
·
5 revisions
Utility class to manage connection parameters to databases and/or services
local params_factory = require('service_utils.db.client_params');
local dbp = require('service_utils.db.client_params');
local p = {
REGISTRAR = {
client_type = 'rdbms',
handler = 'service_utils.db.ev_postgres',
params = {'127.0.0.1', '5432', 'ROC', 'gen', 'GEN'}
},
AAA = {
client_type = 'rdbms',
handler = 'service_utils.db.ev_postgres',
params = {'127.0.0.1', '5432', 'AAA', 'gen', 'GEN'}
},
SUBSCRIBER = {
client_type = 'rdbms',
handler = 'service_utils.db.ev_postgres',
params = {'127.0.0.1', '5433', 'SUBSCRIBER', 'gen', 'GEN'}
},
XCHANGE = {
client_type = 'rdbms',
handler = 'service_utils.db.ev_postgres',
params = {'127.0.0.1', '5434', 'XCHANGE', 'gen', 'GEN'}
},
CONFIG = {
client_type = 'redis',
handler = 'service_utils.db.ev_redis',
params = {'127.0.0.1', '6379', 'CONFIG', 'gen', 'GEN'}
},
INFO_EMAIL_CLIENT = {
client_type = 'smtp',
handler = 'service_utils.SMTP.email_client',
params = {'smtp.gmail.com', '587', 'gmail_tls', 'info@tekenlight.com', 'Tekenlight@1', 'Tekenlight Info'},
},
};
local service_client_params = params_factory.new(p);
return master_db_params;
Instantiates an object containing connection parameters to different services consumed by an application service instance.
p: table, As illustrated in the sample above, attributes of each element in the array are
{ client_type(service name), handler(class path for the service client that handles the protocol),
params [service_url, port, module (in case of databases, schema), user_principal, password, user_name]
}params: table, parameter data
Fetches the set of parameters as table, indexed by service name
...: string(s), 1 or more service names
params: table, parameter data of the mentioned services