-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ [Add] Adding Config structure to the project
+ [Add] Adding Constant structure to the project
- Loading branch information
1 parent
0fd1b4f
commit 5f4d586
Showing
8 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module.exports = { | ||
node_env: process.env.NODE_ENV, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
const {node_env} = require("./common"); | ||
const database = process.env.DATABASE; | ||
|
||
const options = { | ||
useCreateIndex: true, | ||
useNewUrlParser: true, | ||
useFindAndModify: true, | ||
useUnifiedTopology: true, | ||
}; | ||
|
||
const mongodbConfig = node_env === "test" ? | ||
{ | ||
database: process.env.MONGODB_TEST_DATABASE_NAME, | ||
host: process.env.MONGODB_TEST_DATABASE_HOST, | ||
username: process.env.MONGODB_TEST_DATABASE_USER, | ||
password: process.env.MONGODB_TEST_DATABASE_PASS, | ||
dialect: "mongodb", | ||
options, | ||
}: | ||
{ | ||
database: process.env.MONGODB_DATABASE_NAME, | ||
host: process.env.MONGODB_DATABASE_HOST, | ||
username: process.env.MONGODB_DATABASE_USER, | ||
password: process.env.MONGODB_DATABASE_PASS, | ||
dialect: "mongodb", | ||
options, | ||
}; | ||
|
||
const postgresqlConfig = node_env === "test" ? | ||
{ | ||
database: process.env.POSTGRESQL_TEST_DATABASE_NAME, | ||
host: process.env.POSTGRESQL_TEST_DATABASE_HOST, | ||
username: process.env.POSTGRESQL_TEST_DATABASE_USER, | ||
password: process.env.POSTGRESQL_TEST_DATABASE_PASS, | ||
dialect: "postgres", | ||
options:{} | ||
}: | ||
{ | ||
database: process.env.POSTGRESQL_DATABASE_NAME, | ||
host: process.env.POSTGRESQL_DATABASE_HOST, | ||
username: process.env.POSTGRESQL_DATABASE_USER, | ||
password: process.env.POSTGRESQL_DATABASE_PASS, | ||
dialect: "postgres", | ||
options:{} | ||
}; | ||
|
||
module.exports = { | ||
|
||
database, | ||
config:database==="POSTGRESQL"?postgresqlConfig:mongodbConfig | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
database: require("./database"), | ||
common: require("./common"), | ||
request: require("./request") | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
exports.messenger = { | ||
config: { | ||
baseURL: "https://graph.facebook.com/v7.0", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
responseType: "json", | ||
}, | ||
access_token: process.env.MESSENGER_BOT_ACCESS_TOKEN, | ||
}; | ||
|
||
exports.weather = { | ||
config: { | ||
baseURL: "https://api.weatherapi.com/v1", | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
responseType: "json", | ||
}, | ||
api_key: process.env.WEATHER_SERVICE_API_KEY, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
exports.VERIFICATION_TOKEN = process.env.MESSENGER_BOT_VERIFICATION_TOKEN; | ||
exports.ACESS_TOKEN = process.env.MESSENGER_BOT_ACESS_TOKEN; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
MESSAGE:"MESSAGE", | ||
USER:"USER", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/** | ||
* Informational | ||
*/ | ||
exports.HTTP_CONTINUE = 100; | ||
exports.HTTP_SWITCHING_PROTOCOLS = 101; | ||
exports.HTTP_PROCESSING = 102; // RFC2518 | ||
|
||
/** | ||
* Success | ||
*/ | ||
exports.HTTP_OK = 200; | ||
exports.HTTP_CREATED = 201; | ||
exports.HTTP_ACCEPTED = 202; | ||
exports.HTTP_NON_AUTHORITATIVE_INFORMATION = 203; | ||
exports.HTTP_NO_CONTENT = 204; | ||
exports.HTTP_RESET_CONTENT = 205; | ||
exports.HTTP_PARTIAL_CONTENT = 206; | ||
exports.HTTP_MULTI_STATUS = 207; // RFC4918 | ||
exports.HTTP_ALREADY_REPORTED = 208; // RFC5842 | ||
exports.HTTP_IM_USED = 226; // RFC3229 | ||
|
||
/** | ||
* Redirection | ||
*/ | ||
exports.HTTP_MULTIPLE_CHOICES = 300; | ||
exports.HTTP_MOVED_PERMANENTLY = 301; | ||
exports.HTTP_FOUND = 302; | ||
exports.HTTP_SEE_OTHER = 303; | ||
exports.HTTP_NOT_MODIFIED = 304; | ||
exports.HTTP_USE_PROXY = 305; | ||
exports.HTTP_RESERVED = 306; | ||
exports.HTTP_TEMPORARY_REDIRECT = 307; | ||
exports.HTTP_PERMANENTLY_REDIRECT = 308; // RFC7238 | ||
|
||
/** | ||
* Client Error | ||
*/ | ||
exports.HTTP_BAD_REQUEST = 400; | ||
exports.HTTP_UNAUTHORIZED = 401; | ||
exports.HTTP_PAYMENT_REQUIRED = 402; | ||
exports.HTTP_FORBIDDEN = 403; | ||
/** | ||
* The requested resource could not be found | ||
* | ||
* Note: This is sometimes used to mask if there was an UNAUTHORIZED (401) or | ||
* FORBIDDEN (403) error, for security reasons | ||
*/ | ||
exports.HTTP_NOT_FOUND = 404; | ||
exports.HTTP_METHOD_NOT_ALLOWED = 405; | ||
exports.HTTP_NOT_ACCEPTABLE = 406; | ||
exports.HTTP_PROXY_AUTHENTICATION_REQUIRED = 407; | ||
exports.HTTP_REQUEST_TIMEOUT = 408; | ||
exports.HTTP_CONFLICT = 409; | ||
exports.HTTP_GONE = 410; | ||
exports.HTTP_LENGTH_REQUIRED = 411; | ||
exports.HTTP_PRECONDITION_FAILED = 412; | ||
exports.HTTP_REQUEST_ENTITY_TOO_LARGE = 413; | ||
exports.HTTP_REQUEST_URI_TOO_LONG = 414; | ||
exports.HTTP_UNSUPPORTED_MEDIA_TYPE = 415; | ||
exports.HTTP_REQUESTED_RANGE_NOT_SATISFIABLE = 416; | ||
exports.HTTP_EXPECTATION_FAILED = 417; | ||
exports.HTTP_I_AM_A_TEAPOT = 418; // RFC2324 | ||
exports.HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918 | ||
exports.HTTP_LOCKED = 423; // RFC4918 | ||
exports.HTTP_FAILED_DEPENDENCY = 424; // RFC4918 | ||
exports.HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817 | ||
exports.HTTP_UPGRADE_REQUIRED = 426; // RFC2817 | ||
exports.HTTP_PRECONDITION_REQUIRED = 428; // RFC6585 | ||
exports.HTTP_TOO_MANY_REQUESTS = 429; // RFC6585 | ||
exports.HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431; // RFC6585 | ||
|
||
/** | ||
* The server encountered an unexpected error | ||
*/ | ||
exports.HTTP_INTERNAL_SERVER_ERROR = 500; | ||
exports.HTTP_NOT_IMPLEMENTED = 501; | ||
exports.HTTP_BAD_GATEWAY = 502; | ||
exports.HTTP_SERVICE_UNAVAILABLE = 503; | ||
exports.HTTP_GATEWAY_TIMEOUT = 504; | ||
exports.HTTP_VERSION_NOT_SUPPORTED = 505; | ||
exports.HTTP_VARIANT_ALSO_NEGOTIATES_EXPERIMENTAL = 506; // RFC2295 | ||
exports.HTTP_INSUFFICIENT_STORAGE = 507; // RFC4918 | ||
exports.HTTP_LOOP_DETECTED = 508; // RFC5842 | ||
exports.HTTP_NOT_EXTENDED = 510; // RFC2774 | ||
exports.HTTP_NETWORK_AUTHENTICATION_REQUIRED = 511; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
HTTP_CODES: require("./http_codes"), | ||
BOT: require("./bot"), | ||
CACHE_KEYS: require("./cache_keys"), | ||
}; |