11package io .swaglabs .portal .qa .utils ;
22
3+ import lombok .extern .slf4j .Slf4j ;
4+
35import java .util .Objects ;
46import java .util .Properties ;
57
8+ @ Slf4j
69public class WebConfigLoader {
710
811 private static WebConfigLoader instance ;
@@ -24,15 +27,33 @@ public static WebConfigLoader getInstance() {
2427 }
2528
2629 public String getSwagLabsUrl () {
27- return getPropertyValue ("swaglabs.url" );
30+ String url = System .getenv ("SWAGLABS_URL" );
31+ if (url == null || url .isEmpty ()) {
32+ log .info ("Environment variable SWAGLABS_URL is not set, falling back to properties file." );
33+ url = getPropertyValue ("swaglabs.url" );
34+ }
35+ log .info ("SwagLabs URL picked from github secrets." );
36+ return url ;
2837 }
2938
3039 public String getSwagLabsUserName () {
31- return getPropertyValue ("swaglabs.username" );
40+ String username = System .getenv ("SWAGLABS_USERNAME" );
41+ if (username == null || username .isEmpty ()) {
42+ log .info ("Environment variable SWAGLABS_USERNAME is not set, falling back to properties file." );
43+ username = getPropertyValue ("swaglabs.username" );
44+ }
45+ log .info ("SwagLabs Username picked from github secrets." );
46+ return username ;
3247 }
3348
3449 public String getSwagLabsPassword () {
35- return getPropertyValue ("swaglabs.password" );
50+ String password = System .getenv ("SWAGLABS_PASSWORD" );
51+ if (password == null || password .isEmpty ()) {
52+ log .info ("Environment variable SWAGLABS_PASSWORD is not set, falling back to properties file." );
53+ password = getPropertyValue ("swaglabs.password" );
54+ }
55+ log .info ("SwagLabs Password picked from github secrets." );
56+ return password ;
3657 }
3758
3859 private String getPropertyValue (String propertyKey ) {
0 commit comments