File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Load environment variables from .env file
2
+ require ( 'dotenv' ) . config ( ) ;
3
+
4
+ // Configuration object
5
+ const config = {
6
+ authyApiKey : process . env . AUTHY_API_KEY , // Authy API key for MFA
7
+ port : process . env . PORT || 3000 , // Server port, defaults to 3000
8
+ dbConnectionString : process . env . DB_CONNECTION_STRING , // Database connection string
9
+ logLevel : process . env . LOG_LEVEL || 'info' , // Logging level, defaults to 'info'
10
+ } ;
11
+
12
+ // Validate required configurations
13
+ const validateConfig = ( ) => {
14
+ if ( ! config . authyApiKey ) {
15
+ throw new Error ( 'Missing Authy API key. Please set AUTHY_API_KEY in your .env file.' ) ;
16
+ }
17
+ if ( ! config . dbConnectionString ) {
18
+ throw new Error ( 'Missing database connection string. Please set DB_CONNECTION_STRING in your .env file.' ) ;
19
+ }
20
+ } ;
21
+
22
+ // Call the validation function
23
+ validateConfig ( ) ;
24
+
25
+ module . exports = config ;
You can’t perform that action at this time.
0 commit comments