UNPKG

4.92 kBJavaScriptView Raw
1"use strict";
2var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6 return c > 3 && r && Object.defineProperty(target, key, r), r;
7};
8var __metadata = (this && this.__metadata) || function (k, v) {
9 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10};
11Object.defineProperty(exports, "__esModule", { value: true });
12const isLambda = require("is-lambda");
13const Config_1 = require("./Services/Config");
14class APIConfig {
15}
16// If running as a server, this is the port that will be used.
17APIConfig.WEB_PORT = 3000;
18// The root URL for this API, this must be changed when it gets pushed to your production API
19APIConfig.API_URL_BASE = `http://localhost${APIConfig.WEB_PORT === 80 ? "" : `:${APIConfig.WEB_PORT}`}`;
20// If set to true, APIs will only be loaded when they are accessed. This can cut down on memory used in a lambda function.
21APIConfig.LAZY_LOAD_APIS = true;
22// Used to force the API to run as a server, otherwise it will run as a lambda function when deployed serverlessly.
23APIConfig.RUN_AS_SERVER = !isLambda;
24// 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.
25APIConfig.DISPLAY_RAW_ERRORS = false;
26// If set to true, this will log all 400 status errors to console.error.
27APIConfig.LOG_400_ERRORS = false;
28// If set to true, this will log all 500 status errors to console.error.
29APIConfig.LOG_500_ERRORS = true;
30// Slightly more developer (i.e. mostly human) friendly API results. See https://github.com/jheising/HAPI
31APIConfig.OUTPUT_HAPI_RESULTS = true;
32APIConfig.AWS_REGION = "us-east-1";
33// TODO: CHANGE THIS!!
34APIConfig.ENCRYPTION_SECRET = "E1E8A96B838495F8CD1310304361C741";
35// This is the key-value storage service provider to use with your API (if you need it)
36APIConfig.KV_STORAGE_SERVICE_PROVIDER = "DiskKVService";
37// The storage path to be used when using the DiskKVService
38APIConfig.DISK_KV_STORAGE_ROOT_PATH = "./data/kv";
39// If set to true this will encrypt data stored in the Key-Value Service
40APIConfig.ENCRYPT_KV_DATA = true;
41// This is the file storage service provider to use with your API (if you need it)
42APIConfig.FILE_STORAGE_SERVICE_PROVIDER = "DiskFileService";
43APIConfig.DISK_FILE_SERVICE_ROOT_PATH = "./data";
44__decorate([
45 Config_1.EnvVarSync,
46 __metadata("design:type", Number)
47], APIConfig, "WEB_PORT", void 0);
48__decorate([
49 Config_1.EnvVarSync,
50 __metadata("design:type", String)
51], APIConfig, "API_URL_BASE", void 0);
52__decorate([
53 Config_1.EnvVarSync,
54 __metadata("design:type", Boolean)
55], APIConfig, "LAZY_LOAD_APIS", void 0);
56__decorate([
57 Config_1.EnvVarSync,
58 __metadata("design:type", Boolean)
59], APIConfig, "RUN_AS_SERVER", void 0);
60__decorate([
61 Config_1.EnvVarSync,
62 __metadata("design:type", Boolean)
63], APIConfig, "DISPLAY_RAW_ERRORS", void 0);
64__decorate([
65 Config_1.EnvVarSync,
66 __metadata("design:type", Boolean)
67], APIConfig, "LOG_400_ERRORS", void 0);
68__decorate([
69 Config_1.EnvVarSync,
70 __metadata("design:type", Boolean)
71], APIConfig, "LOG_500_ERRORS", void 0);
72__decorate([
73 Config_1.EnvVarSync,
74 __metadata("design:type", Boolean)
75], APIConfig, "OUTPUT_HAPI_RESULTS", void 0);
76__decorate([
77 Config_1.EnvVarSync,
78 __metadata("design:type", String)
79], APIConfig, "AWS_REGION", void 0);
80__decorate([
81 Config_1.EnvVarSync,
82 __metadata("design:type", String)
83], APIConfig, "ENCRYPTION_SECRET", void 0);
84__decorate([
85 Config_1.EnvVarSync,
86 __metadata("design:type", String)
87], APIConfig, "KV_STORAGE_SERVICE_PROVIDER", void 0);
88__decorate([
89 Config_1.EnvVarSync,
90 __metadata("design:type", String)
91], APIConfig, "DISK_KV_STORAGE_ROOT_PATH", void 0);
92__decorate([
93 Config_1.EnvVarSync,
94 __metadata("design:type", Boolean)
95], APIConfig, "ENCRYPT_KV_DATA", void 0);
96__decorate([
97 Config_1.EnvVarSync,
98 __metadata("design:type", String)
99], APIConfig, "DYNAMO_KV_STORAGE_TABLE_NAME", void 0);
100__decorate([
101 Config_1.EnvVarSync,
102 __metadata("design:type", String)
103], APIConfig, "FILE_STORAGE_SERVICE_PROVIDER", void 0);
104__decorate([
105 Config_1.EnvVarSync,
106 __metadata("design:type", String)
107], APIConfig, "DISK_FILE_SERVICE_ROOT_PATH", void 0);
108__decorate([
109 Config_1.EnvVarSync,
110 __metadata("design:type", String)
111], APIConfig, "S3_FILE_SERVICE_BUCKET_NAME", void 0);
112exports.APIConfig = APIConfig;
113//# sourceMappingURL=APIConfig.js.map
\No newline at end of file