Skip to content

Commit 944bcf1

Browse files
author
Praveen Narayanappa
committed
Conditional handling of config.yml file
Signed-off-by: Praveen Narayanappa <pnarayanappa@waldevdbctpyl01.dev.rocketsoftware.com>
1 parent 331a688 commit 944bcf1

1 file changed

Lines changed: 56 additions & 0 deletions

File tree

IBM_DB_Adapter/ibm_db/test/config.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,82 @@ connections:
4848
database: arunit2
4949

5050
ibm_db:
51+
<% env_not_set = false %>
5152
arunit:
53+
<% if ENV['DB2_USER1'] %>
5254
username: <%= ENV['DB2_USER1'] %>
55+
<% else %>
56+
<% puts "Warning: Environment variable DB2_USER1 is not set." %>
57+
<% env_not_set = true %>
58+
<% end %>
59+
<% if ENV['DB2_PASSWD1'] %>
5360
password: <%= ENV['DB2_PASSWD1'] %>
61+
<% else %>
62+
<% puts "Warning: Environment variable DB2_PASSWD1 is not set." %>
63+
<% env_not_set = true %>
64+
<% end %>
65+
<% if ENV['DB2_DATABASE1'] %>
5466
database: <%= ENV['DB2_DATABASE1'] %>
67+
<% else %>
68+
<% puts "Warning: Environment variable DB2_DATABASE1 is not set." %>
69+
<% env_not_set = true %>
70+
<% end %>
71+
<% if ENV['DB2_HOST1'] %>
5572
host: <%= ENV['DB2_HOST1'] %>
73+
<% else %>
74+
<% puts "Warning: Environment variable DB2_HOST1 is not set." %>
75+
<% env_not_set = true %>
76+
<% end %>
77+
<% if ENV['DB2_PORT1'] %>
5678
port: <%= ENV['DB2_PORT1'] %>
79+
<% else %>
80+
<% puts "Warning: Environment variable DB2_PORT1 is not set." %>
81+
<% env_not_set = true %>
82+
<% end %>
5783
start_id: 1000
5884
parameterized: true
5985
statement_limit: 1000
6086
# debug: true
6187
arunit2:
88+
<% if ENV['DB2_USER2'] %>
6289
username: <%= ENV['DB2_USER2'] %>
90+
<% else %>
91+
<% puts "Warning: Environment variable DB2_USER2 is not set." %>
92+
<% env_not_set = true %>
93+
<% end %>
94+
<% if ENV['DB2_PASSWD2'] %>
6395
password: <%= ENV['DB2_PASSWD2'] %>
96+
<% else %>
97+
<% puts "Warning: Environment variable DB2_PASSWD2 is not set." %>
98+
<% env_not_set = true %>
99+
<% end %>
100+
<% if ENV['DB2_DATABASE2'] %>
64101
database: <%= ENV['DB2_DATABASE2'] %>
102+
<% else %>
103+
<% puts "Warning: Environment variable DB2_DATABASE2 is not set." %>
104+
<% env_not_set = true %>
105+
<% end %>
106+
<% if ENV['DB2_HOST2'] %>
65107
host: <%= ENV['DB2_HOST2'] %>
108+
<% else %>
109+
<% puts "Warning: Environment variable DB2_HOST2 is not set." %>
110+
<% env_not_set = true %>
111+
<% end %>
112+
<% if ENV['DB2_PORT2'] %>
66113
port: <%= ENV['DB2_PORT2'] %>
114+
<% else %>
115+
<% puts "Warning: Environment variable DB2_PORT2 is not set." %>
116+
<% env_not_set = true %>
117+
<% end %>
67118
start_id: 1000
68119
parameterized: true
69120
statement_limit: 1000
70121
# debug: true
122+
<% if env_not_set == true %>
123+
<% puts "Please set it before running test file and avoid" %>
124+
<% puts "hardcoded password in confi.yml file." %>
125+
<% exit(1) %>
126+
<% end %>
71127

72128
firebird:
73129
arunit:

0 commit comments

Comments
 (0)