Spaces:
Running
Running
Commit
·
9a15d4e
1
Parent(s):
cf843e4
update(swagger): get dynamic host
Browse files
src/configs/config.ts
CHANGED
@@ -4,6 +4,7 @@ dotenv.config();
|
|
4 |
|
5 |
export interface Config {
|
6 |
port: number;
|
|
|
7 |
db: {
|
8 |
uri: string;
|
9 |
};
|
@@ -16,6 +17,7 @@ export interface Config {
|
|
16 |
|
17 |
export const config: Config = {
|
18 |
port: Env.get("PORT", 4000).toNumber(),
|
|
|
19 |
db: {
|
20 |
uri: Env.get("DB_URI").toString(),
|
21 |
},
|
|
|
4 |
|
5 |
export interface Config {
|
6 |
port: number;
|
7 |
+
host: string;
|
8 |
db: {
|
9 |
uri: string;
|
10 |
};
|
|
|
17 |
|
18 |
export const config: Config = {
|
19 |
port: Env.get("PORT", 4000).toNumber(),
|
20 |
+
host: Env.get("HOST", "http://localhost").toString(),
|
21 |
db: {
|
22 |
uri: Env.get("DB_URI").toString(),
|
23 |
},
|
src/lib/swagger/swagger.ts
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
/**
|
2 |
* Swagger registry class.
|
3 |
*/
|
@@ -173,7 +175,7 @@ class SwaggerRegistry {
|
|
173 |
},
|
174 |
servers: [
|
175 |
{
|
176 |
-
url:
|
177 |
},
|
178 |
],
|
179 |
security: [
|
|
|
1 |
+
import { config } from "@configs/config";
|
2 |
+
|
3 |
/**
|
4 |
* Swagger registry class.
|
5 |
*/
|
|
|
175 |
},
|
176 |
servers: [
|
177 |
{
|
178 |
+
url: `${config.host}:${config.port}`,
|
179 |
},
|
180 |
],
|
181 |
security: [
|
src/modules/users/modules/auth/validation/login.validation.ts
CHANGED
@@ -10,21 +10,15 @@ export const loginValidationKeys = {
|
|
10 |
email: joi
|
11 |
.string()
|
12 |
.required()
|
13 |
-
.email({
|
14 |
-
minDomainSegments: 2,
|
15 |
-
tlds: { allow: ["com", "net", "org", "eg", "io"] },
|
16 |
-
})
|
17 |
.empty()
|
18 |
.messages({
|
19 |
-
"string.email": "please enter a valid email",
|
20 |
"any.required": "email must be entered",
|
21 |
"string.empty": "email can not be empty",
|
22 |
}),
|
23 |
-
password: joi.string().empty().
|
24 |
"string.base": "please enter a valid password",
|
25 |
"any.required": "password must be entered",
|
26 |
"string.empty": "password cannot be empty",
|
27 |
-
"string.min": "password must be at least 8 characters",
|
28 |
}),
|
29 |
};
|
30 |
|
|
|
10 |
email: joi
|
11 |
.string()
|
12 |
.required()
|
|
|
|
|
|
|
|
|
13 |
.empty()
|
14 |
.messages({
|
|
|
15 |
"any.required": "email must be entered",
|
16 |
"string.empty": "email can not be empty",
|
17 |
}),
|
18 |
+
password: joi.string().empty().required().messages({
|
19 |
"string.base": "please enter a valid password",
|
20 |
"any.required": "password must be entered",
|
21 |
"string.empty": "password cannot be empty",
|
|
|
22 |
}),
|
23 |
};
|
24 |
|