11import 'should' ;
2- import { config , isEnclavedConfig , TlsMode } from '../config ' ;
2+ import { initConfig , isEnclavedConfig , TlsMode } from '../initConfig ' ;
33
44describe ( 'Configuration' , ( ) => {
55 const originalEnv = process . env ;
@@ -17,14 +17,14 @@ describe('Configuration', () => {
1717 } ) ;
1818
1919 it ( 'should throw error when APP_MODE is not set' , ( ) => {
20- ( ( ) => config ( ) ) . should . throw (
20+ ( ( ) => initConfig ( ) ) . should . throw (
2121 'APP_MODE environment variable is required. Set APP_MODE to either "enclaved" or "master-express"' ,
2222 ) ;
2323 } ) ;
2424
2525 it ( 'should throw error when APP_MODE is invalid' , ( ) => {
2626 process . env . APP_MODE = 'invalid' ;
27- ( ( ) => config ( ) ) . should . throw (
27+ ( ( ) => initConfig ( ) ) . should . throw (
2828 'Invalid APP_MODE: invalid. Must be either "enclaved" or "master-express"' ,
2929 ) ;
3030 } ) ;
@@ -39,7 +39,7 @@ describe('Configuration', () => {
3939 } ) ;
4040
4141 it ( 'should use default configuration when no environment variables are set' , ( ) => {
42- const cfg = config ( ) ;
42+ const cfg = initConfig ( ) ;
4343 isEnclavedConfig ( cfg ) . should . be . true ( ) ;
4444 if ( isEnclavedConfig ( cfg ) ) {
4545 cfg . port . should . equal ( 3080 ) ;
@@ -54,7 +54,7 @@ describe('Configuration', () => {
5454
5555 it ( 'should read port from environment variable' , ( ) => {
5656 process . env . ENCLAVED_EXPRESS_PORT = '4000' ;
57- const cfg = config ( ) ;
57+ const cfg = initConfig ( ) ;
5858 isEnclavedConfig ( cfg ) . should . be . true ( ) ;
5959 if ( isEnclavedConfig ( cfg ) ) {
6060 cfg . port . should . equal ( 4000 ) ;
@@ -67,7 +67,7 @@ describe('Configuration', () => {
6767 it ( 'should read TLS mode from environment variables' , ( ) => {
6868 // Test with TLS disabled
6969 process . env . TLS_MODE = 'disabled' ;
70- let cfg = config ( ) ;
70+ let cfg = initConfig ( ) ;
7171 isEnclavedConfig ( cfg ) . should . be . true ( ) ;
7272 if ( isEnclavedConfig ( cfg ) ) {
7373 cfg . tlsMode . should . equal ( TlsMode . DISABLED ) ;
@@ -76,7 +76,7 @@ describe('Configuration', () => {
7676
7777 // Test with mTLS explicitly enabled
7878 process . env . TLS_MODE = 'mtls' ;
79- cfg = config ( ) ;
79+ cfg = initConfig ( ) ;
8080 isEnclavedConfig ( cfg ) . should . be . true ( ) ;
8181 if ( isEnclavedConfig ( cfg ) ) {
8282 cfg . tlsMode . should . equal ( TlsMode . MTLS ) ;
@@ -87,13 +87,13 @@ describe('Configuration', () => {
8787
8888 // Test with invalid TLS mode
8989 process . env . TLS_MODE = 'invalid' ;
90- ( ( ) => config ( ) ) . should . throw (
90+ ( ( ) => initConfig ( ) ) . should . throw (
9191 'Invalid TLS_MODE: invalid. Must be either "disabled" or "mtls"' ,
9292 ) ;
9393
9494 // Test with no TLS mode (should default to MTLS)
9595 delete process . env . TLS_MODE ;
96- cfg = config ( ) ;
96+ cfg = initConfig ( ) ;
9797 isEnclavedConfig ( cfg ) . should . be . true ( ) ;
9898 if ( isEnclavedConfig ( cfg ) ) {
9999 cfg . tlsMode . should . equal ( TlsMode . MTLS ) ;
@@ -108,7 +108,7 @@ describe('Configuration', () => {
108108 process . env . MTLS_REJECT_UNAUTHORIZED = 'true' ;
109109 process . env . MTLS_ALLOWED_CLIENT_FINGERPRINTS = 'ABC123,DEF456' ;
110110
111- const cfg = config ( ) ;
111+ const cfg = initConfig ( ) ;
112112 isEnclavedConfig ( cfg ) . should . be . true ( ) ;
113113 if ( isEnclavedConfig ( cfg ) ) {
114114 cfg . mtlsRequestCert ! . should . be . true ( ) ;
0 commit comments