File tree Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Original file line number Diff line number Diff line change 1
- import { env } from "../src/typeDefinitions/default.types" ;
1
+ import { env , environment } from "../src/typeDefinitions/default.types" ;
2
2
import {
3
3
RDS_BASE_API_URL ,
4
4
RDS_BASE_STAGING_API_URL ,
5
5
RDS_BASE_DEVELOPMENT_API_URL ,
6
6
} from "../src/constants/urls" ;
7
7
8
8
const config = ( env : env ) => {
9
- const environment = { RDS_BASE_API_URL : "" } ;
9
+ const environment : environment = {
10
+ production : {
11
+ RDS_BASE_API_URL : RDS_BASE_API_URL ,
12
+ } ,
13
+ staging : {
14
+ RDS_BASE_API_URL : RDS_BASE_STAGING_API_URL ,
15
+ } ,
16
+ default : {
17
+ RDS_BASE_API_URL : RDS_BASE_DEVELOPMENT_API_URL ,
18
+ } ,
19
+ } ;
10
20
11
- switch ( env . CURRENT_ENVIRONMENT ) {
12
- case "production" :
13
- environment . RDS_BASE_API_URL = RDS_BASE_API_URL ;
14
- break ;
15
-
16
- case "staging" :
17
- environment . RDS_BASE_API_URL = RDS_BASE_STAGING_API_URL ;
18
- break ;
19
-
20
- default :
21
- environment . RDS_BASE_API_URL = RDS_BASE_DEVELOPMENT_API_URL ;
22
- }
23
-
24
- return environment ;
21
+ return environment [ env . CURRENT_ENVIRONMENT ] || environment . default ;
25
22
} ;
26
23
27
24
export default config ;
Original file line number Diff line number Diff line change @@ -2,6 +2,14 @@ export interface env {
2
2
[ key : string ] : string ;
3
3
}
4
4
5
+ export interface environment {
6
+ [ key : string ] : variables ;
7
+ }
8
+
9
+ export interface variables {
10
+ RDS_BASE_API_URL : string ;
11
+ }
12
+
5
13
export interface discordCommand {
6
14
name : string ;
7
15
description : string ;
You can’t perform that action at this time.
0 commit comments