File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -95,4 +95,26 @@ export class CommonUtils {
9595 }
9696 return result ;
9797 }
98+
99+ /**
100+ * Resolve the Topcoder application domain from configuration with safe fallbacks.
101+ * @param configService Nest config service (or look-alike) used to read env config
102+ * @returns application domain such as topcoder-dev.com
103+ */
104+ static getAppDomain (
105+ configService ?: { get < T = any > ( key : string ) : T | undefined } ,
106+ ) : string {
107+ const envDomain = process . env . APP_DOMAIN ;
108+ if ( envDomain && envDomain . trim ( ) . length > 0 ) {
109+ return envDomain . trim ( ) ;
110+ }
111+
112+ // Fallback to topcoder.com for prod, if APP_DOMAIN isn't set
113+ const nodeEnv = process . env . NODE_ENV ?. toLowerCase ( ) ;
114+ if ( nodeEnv === 'prod' || nodeEnv === 'production' ) {
115+ return 'topcoder.com' ;
116+ }
117+
118+ return 'topcoder-dev.com' ;
119+ }
98120}
You can’t perform that action at this time.
0 commit comments