Skip to content

Commit

Permalink
Adding support to read from env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
ChinthakaJ98 committed Nov 30, 2023
1 parent e142b18 commit 17b5cce
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,15 @@ protected void buildDataSource(OMElement elem, AbstractDBMediator mediator) {
}

private void readLookupConfig(AbstractDBMediator mediator, OMElement pool) {
String dataSourceName = getValue(pool, DSNAME_Q);
mediator.setDataSourceName(dataSourceName);
String resolvedDataSourceName = ResolverFactory.getInstance().getResolver(getValue(pool, DSNAME_Q)).resolve();
mediator.setDataSourceName(resolvedDataSourceName);
saveElementConfig(pool, DSNAME_Q, mediator);

if (pool.getFirstChildWithName(ICCLASS_Q) != null) {
String resolvedInitialContextClass = ResolverFactory.getInstance()
.getResolver(getValue(pool, ICCLASS_Q)).resolve();
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, getValue(pool, ICCLASS_Q));
props.put(Context.INITIAL_CONTEXT_FACTORY, resolvedInitialContextClass);
props.put(Context.PROVIDER_URL, getValue(pool, URL_Q));
props.put(Context.SECURITY_PRINCIPAL, getValue(pool, USER_Q));
props.put(Context.SECURITY_CREDENTIALS, getValue(pool, PASS_Q));
Expand Down

0 comments on commit 17b5cce

Please sign in to comment.