1 | import isLambda from "is-lambda";
|
2 | import {get} from "lodash";
|
3 | import {EnvVarSync} from "./Services/Config";
|
4 |
|
5 | export class APIConfig {
|
6 |
|
7 | @EnvVarSync
|
8 | static WEB_PORT: number = 3000;
|
9 |
|
10 |
|
11 | @EnvVarSync
|
12 | static API_URL_BASE: string = `http://localhost${APIConfig.WEB_PORT === 80 ? "" : `:${APIConfig.WEB_PORT}`}`;
|
13 |
|
14 | // If set to true, APIs will only be loaded when they are accessed. This can cut down on memory used in a lambda function.
|
15 | @EnvVarSync
|
16 | static LAZY_LOAD_APIS: boolean = true;
|
17 |
|
18 | // Used to force the API to run as a server, otherwise it will run as a lambda function when deployed serverlessly.
|
19 | @EnvVarSync
|
20 | static RUN_AS_SERVER: boolean = !isLambda;
|
21 |
|
22 | // If set to true, raw error messages will be included in errors output from the API. This can be useful for debugging, but should usually be turned off in production.
|
23 | @EnvVarSync
|
24 | static DISPLAY_RAW_ERRORS: boolean = false;
|
25 |
|
26 | // If set to true, this will log all 400 status errors to console.error.
|
27 | @EnvVarSync
|
28 | static LOG_400_ERRORS: boolean = false;
|
29 |
|
30 | // If set to true, this will log all 500 status errors to console.error.
|
31 | @EnvVarSync
|
32 | static LOG_500_ERRORS: boolean = true;
|
33 |
|
34 | // Slightly more developer (i.e. mostly human) friendly API results. See https://github.com/jheising/HAPI
|
35 | @EnvVarSync
|
36 | static OUTPUT_HAPI_RESULTS: boolean = true;
|
37 |
|
38 | @EnvVarSync
|
39 | static AWS_REGION: string = "us-east-1";
|
40 |
|
41 | // TODO: CHANGE THIS BY SETTING AN ENVIRONMENT VARIABLE NAMED ENCRYPTION_SECRET
|
42 | @EnvVarSync
|
43 | static ENCRYPTION_SECRET:string = "E1E8A96B838495F8CD1310304361C741";
|
44 |
|
45 | // This is the key-value storage service provider to use with your API (if you need it)
|
46 | @EnvVarSync
|
47 | static KV_STORAGE_SERVICE_PROVIDER: "MemoryKVService" | "DiskKVService" | "DynamoDBKVService" = "DiskKVService";
|
48 |
|
49 | // The storage path to be used when using the DiskKVService
|
50 | @EnvVarSync
|
51 | static DISK_KV_STORAGE_ROOT_PATH: string = "./data/kv";
|
52 |
|
53 | // If set to true this will encrypt data stored in the Key-Value Service
|
54 | @EnvVarSync
|
55 | static ENCRYPT_KV_DATA:boolean = true;
|
56 |
|
57 | // The table name to use when storing key-value data in DynamoDB
|
58 | @EnvVarSync
|
59 | static DYNAMO_KV_STORAGE_TABLE_NAME: string;
|
60 |
|
61 | // This is the file storage service provider to use with your API (if you need it)
|
62 | @EnvVarSync
|
63 | static FILE_STORAGE_SERVICE_PROVIDER: "DiskFileService" | "S3FileService" = "DiskFileService";
|
64 |
|
65 | @EnvVarSync
|
66 | static DISK_FILE_SERVICE_ROOT_PATH: string = "./data";
|
67 |
|
68 | @EnvVarSync
|
69 | static S3_FILE_SERVICE_BUCKET_NAME: string;
|
70 |
|
71 | // TODO: CHANGE THIS BY SETTING AN ENVIRONMENT VARIABLE NAMED JWT_SECRET
|
72 | @EnvVarSync
|
73 | static JWT_SECRET:string = "65e068de-81ef-457d-b00a-82364c360226";
|
74 | } |
\ | No newline at end of file |