@diagramers/cli 1.0.22 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -3
- package/dist/services/template-updater.d.ts +2 -0
- package/dist/services/template-updater.d.ts.map +1 -1
- package/dist/services/template-updater.js +66 -14
- package/dist/services/template-updater.js.map +1 -1
- package/package.json +5 -1
- package/templates/api/certs/auth-app-cert.json +13 -0
- package/templates/api/main.ts +10 -0
- package/templates/api/package.json +70 -0
- package/templates/api/src/assets/css/email-template.css +8 -0
- package/templates/api/src/assets/images/logo_large.png +0 -0
- package/templates/api/src/assets/keys/certificate.pem +22 -0
- package/templates/api/src/assets/keys/private-key.pem +28 -0
- package/templates/api/src/config/config-interface.ts +191 -0
- package/templates/api/src/config/development.ts +145 -0
- package/templates/api/src/config/index.ts +59 -0
- package/templates/api/src/config/production.ts +145 -0
- package/templates/api/src/config/staging.ts +144 -0
- package/templates/api/src/config/uat.ts +144 -0
- package/templates/api/src/controllers/account-controller.ts +162 -0
- package/templates/api/src/entities/audit.ts +12 -0
- package/templates/api/src/entities/base-entity.ts +10 -0
- package/templates/api/src/entities/user.ts +71 -0
- package/templates/api/src/helpers/FrameworkHelper.ts +157 -0
- package/templates/api/src/helpers/auth.ts +971 -0
- package/templates/api/src/helpers/cronHelper.ts +170 -0
- package/templates/api/src/helpers/dbcontext.ts +83 -0
- package/templates/api/src/helpers/encryptionHelper.ts +76 -0
- package/templates/api/src/helpers/enums.ts +258 -0
- package/templates/api/src/helpers/handle-response.ts +49 -0
- package/templates/api/src/helpers/httpHelper.ts +75 -0
- package/templates/api/src/helpers/mailer.ts +152 -0
- package/templates/api/src/helpers/result.ts +47 -0
- package/templates/api/src/helpers/string-helper.ts +27 -0
- package/templates/api/src/routes/account-routes.ts +37 -0
- package/templates/api/src/routes/auth-routes.ts +286 -0
- package/templates/api/src/routes/index.ts +92 -0
- package/templates/api/src/schemas/audit.ts +36 -0
- package/templates/api/src/schemas/otp.ts +52 -0
- package/templates/api/src/schemas/session.ts +57 -0
- package/templates/api/src/schemas/user.ts +125 -0
- package/templates/api/src/server/index.ts +86 -0
- package/templates/api/src/server/socket-server-provider.ts +209 -0
- package/templates/api/src/services/account-service.ts +243 -0
- package/templates/api/src/services/audit-service.ts +56 -0
- package/templates/api/tsconfig.json +16 -0
- package/templates/api/webpack.config.js +66 -0
- package/scripts/publish.sh +0 -58
- package/scripts/setup.sh +0 -38
- package/scripts/version.sh +0 -80
- package/src/commands/api.ts +0 -76
- package/src/commands/extend.ts +0 -35
- package/src/commands/init.ts +0 -32
- package/src/commands/update.ts +0 -25
- package/src/config/template-config.ts +0 -111
- package/src/index.ts +0 -41
- package/src/services/api-generator.ts +0 -378
- package/src/services/project-extender.ts +0 -330
- package/src/services/project-initializer.ts +0 -335
- package/src/services/project-updater.ts +0 -117
- package/src/services/relation-generator.ts +0 -203
- package/src/services/table-generator.ts +0 -114
- package/src/services/template-processor.ts +0 -166
- package/src/services/template-updater.ts +0 -184
- package/tsconfig.json +0 -19
@@ -0,0 +1,145 @@
|
|
1
|
+
import { WhatsappProviders, AuthProvider, OAuthProvider } from "../helpers/enums";
|
2
|
+
import { IConfigProps, WhatsappProvidersConfig, FirebaseConfig, AuthConfig } from "./config-interface";
|
3
|
+
|
4
|
+
class Development implements IConfigProps {
|
5
|
+
isDev = true;
|
6
|
+
isProd = false;
|
7
|
+
host_name: string = process.env.HOST || 'localhost';
|
8
|
+
port: string = process.env.PORT || '4000';
|
9
|
+
database_connectionstring: string = process.env.MONGODB_URI || "mongodb://127.0.0.1:27017/tactic-development";
|
10
|
+
base_site_url: string = process.env.BASE_SITE_URL || "http://localhost:3000";
|
11
|
+
development_environment_url: string = "http://localhost:4000";
|
12
|
+
register_complete_page_url: string = "register_complete";
|
13
|
+
whatsapp_default_provider: WhatsappProviders = WhatsappProviders.twilio;
|
14
|
+
whatsapp_providers_configurations = [{
|
15
|
+
key: WhatsappProviders.twilio,
|
16
|
+
value: {
|
17
|
+
provider_type: WhatsappProviders.twilio,
|
18
|
+
account_id: process.env.TWILIO_ACCOUNT_SID || 'AC55b03a222fa486300e5791d8f34cfacd',
|
19
|
+
token: process.env.TWILIO_AUTH_TOKEN || 'c3cc0022815391e027b7bf4bac47b46c'
|
20
|
+
}
|
21
|
+
}];
|
22
|
+
firebase_application_config: FirebaseConfig = {
|
23
|
+
apiKey: process.env.FIREBASE_API_KEY || "AIzaSyCyRHzm2f_CooMRbYpRVV0MpptBu-HdEs4",
|
24
|
+
authDomain: process.env.FIREBASE_AUTH_DOMAIN || "app.sendifier.com",
|
25
|
+
projectId: process.env.FIREBASE_PROJECT_ID || "sendifier-web-app",
|
26
|
+
storageBucket: process.env.FIREBASE_STORAGE_BUCKET || "sendifier-web-app.appspot.com",
|
27
|
+
messagingSenderId: process.env.FIREBASE_MESSAGING_SENDER_ID || "717324879598",
|
28
|
+
appId: process.env.FIREBASE_APP_ID || "1:717324879598:web:8d4f09d06c30cc435855ff"
|
29
|
+
};
|
30
|
+
firebase_auth_certification_path = `functions/certs/auth-app-cert.json`;
|
31
|
+
internal_http_request_header_key = 'x-internal-request';
|
32
|
+
internal_http_request_header_value = process.env.INTERNAL_REQUEST_HEADER_VALUE || 'BHQGYqbN(Iu8MjgspaJzHRVSyahvbXuLPT%rI^)FDJ(At@k3vKm3E!Qp%EcJqGDt';
|
33
|
+
|
34
|
+
// Authentication Configuration
|
35
|
+
auth: AuthConfig = {
|
36
|
+
enabled_providers: [AuthProvider.INTERNAL, AuthProvider.FIREBASE, AuthProvider.SMS_OTP, AuthProvider.EMAIL_OTP],
|
37
|
+
default_provider: AuthProvider.INTERNAL,
|
38
|
+
|
39
|
+
jwt: {
|
40
|
+
secret: process.env.JWT_SECRET || 'your-super-secret-jwt-key-change-in-production',
|
41
|
+
expires_in: '24h',
|
42
|
+
refresh_token_expires_in: '7d',
|
43
|
+
issuer: 'diagramers-api',
|
44
|
+
audience: 'diagramers-users'
|
45
|
+
},
|
46
|
+
|
47
|
+
internal: {
|
48
|
+
password_min_length: 8,
|
49
|
+
password_require_uppercase: true,
|
50
|
+
password_require_lowercase: true,
|
51
|
+
password_require_numbers: true,
|
52
|
+
password_require_special_chars: true,
|
53
|
+
max_login_attempts: 5,
|
54
|
+
lockout_duration_minutes: 15,
|
55
|
+
require_email_verification: true,
|
56
|
+
require_phone_verification: false
|
57
|
+
},
|
58
|
+
|
59
|
+
firebase: {
|
60
|
+
enabled: true,
|
61
|
+
project_id: process.env.FIREBASE_PROJECT_ID || "sendifier-web-app",
|
62
|
+
private_key_path: process.env.FIREBASE_PRIVATE_KEY_PATH || "functions/certs/auth-app-cert.json",
|
63
|
+
client_email: process.env.FIREBASE_CLIENT_EMAIL || "",
|
64
|
+
api_key: process.env.FIREBASE_API_KEY || "AIzaSyCyRHzm2f_CooMRbYpRVV0MpptBu-HdEs4",
|
65
|
+
auth_domain: process.env.FIREBASE_AUTH_DOMAIN || "app.sendifier.com",
|
66
|
+
storage_bucket: process.env.FIREBASE_STORAGE_BUCKET || "sendifier-web-app.appspot.com",
|
67
|
+
messaging_sender_id: process.env.FIREBASE_MESSAGING_SENDER_ID || "717324879598",
|
68
|
+
app_id: process.env.FIREBASE_APP_ID || "1:717324879598:web:8d4f09d06c30cc435855ff"
|
69
|
+
},
|
70
|
+
|
71
|
+
oauth: {
|
72
|
+
enabled_providers: [OAuthProvider.GOOGLE, OAuthProvider.FACEBOOK, OAuthProvider.GITHUB],
|
73
|
+
providers: {
|
74
|
+
[OAuthProvider.GOOGLE]: {
|
75
|
+
client_id: process.env.GOOGLE_CLIENT_ID || "",
|
76
|
+
client_secret: process.env.GOOGLE_CLIENT_SECRET || "",
|
77
|
+
redirect_uri: process.env.GOOGLE_REDIRECT_URI || "http://localhost:4000/auth/google/callback",
|
78
|
+
scope: ['email', 'profile'],
|
79
|
+
enabled: true
|
80
|
+
},
|
81
|
+
[OAuthProvider.FACEBOOK]: {
|
82
|
+
client_id: process.env.FACEBOOK_CLIENT_ID || "",
|
83
|
+
client_secret: process.env.FACEBOOK_CLIENT_SECRET || "",
|
84
|
+
redirect_uri: process.env.FACEBOOK_REDIRECT_URI || "http://localhost:4000/auth/facebook/callback",
|
85
|
+
scope: ['email', 'public_profile'],
|
86
|
+
enabled: true
|
87
|
+
},
|
88
|
+
[OAuthProvider.GITHUB]: {
|
89
|
+
client_id: process.env.GITHUB_CLIENT_ID || "",
|
90
|
+
client_secret: process.env.GITHUB_CLIENT_SECRET || "",
|
91
|
+
redirect_uri: process.env.GITHUB_REDIRECT_URI || "http://localhost:4000/auth/github/callback",
|
92
|
+
scope: ['user:email'],
|
93
|
+
enabled: true
|
94
|
+
}
|
95
|
+
},
|
96
|
+
callback_url: "http://localhost:4000/auth/callback",
|
97
|
+
state_secret: process.env.OAUTH_STATE_SECRET || "your-oauth-state-secret"
|
98
|
+
},
|
99
|
+
|
100
|
+
sms_otp: {
|
101
|
+
enabled: true,
|
102
|
+
provider: 'twilio',
|
103
|
+
twilio: {
|
104
|
+
account_sid: process.env.TWILIO_ACCOUNT_SID || 'AC55b03a222fa486300e5791d8f34cfacd',
|
105
|
+
auth_token: process.env.TWILIO_AUTH_TOKEN || 'c3cc0022815391e027b7bf4bac47b46c',
|
106
|
+
from_number: process.env.TWILIO_FROM_NUMBER || '+1234567890'
|
107
|
+
},
|
108
|
+
otp_length: 6,
|
109
|
+
otp_expiry_minutes: 10,
|
110
|
+
max_attempts: 3
|
111
|
+
},
|
112
|
+
|
113
|
+
email_otp: {
|
114
|
+
enabled: true,
|
115
|
+
smtp: {
|
116
|
+
host: process.env.SMTP_HOST || 'smtp.gmail.com',
|
117
|
+
port: parseInt(process.env.SMTP_PORT || '587'),
|
118
|
+
secure: false,
|
119
|
+
user: process.env.SMTP_USER || 'your-email@gmail.com',
|
120
|
+
pass: process.env.SMTP_PASS || 'your-app-password'
|
121
|
+
},
|
122
|
+
otp_length: 6,
|
123
|
+
otp_expiry_minutes: 15,
|
124
|
+
max_attempts: 3,
|
125
|
+
from_email: process.env.FROM_EMAIL || 'noreply@diagramers.com',
|
126
|
+
from_name: process.env.FROM_NAME || 'Diagramers'
|
127
|
+
},
|
128
|
+
|
129
|
+
session: {
|
130
|
+
max_sessions_per_user: 5,
|
131
|
+
session_timeout_minutes: 1440, // 24 hours
|
132
|
+
remember_me_days: 30,
|
133
|
+
concurrent_login_allowed: true
|
134
|
+
}
|
135
|
+
};
|
136
|
+
http_request_header_requestidentifier_key = 'p-request-identifier';
|
137
|
+
redirect_all_requests_to_local = false;
|
138
|
+
local_api_tunnel_url = process.env.LOCAL_API_TUNNEL_URL || "https://humble-macaw-separately.ngrok-free.app";
|
139
|
+
load_scheduled_tasks: boolean = false;
|
140
|
+
local_ui_tunnel_url = process.env.LOCAL_UI_TUNNEL_URL || "";
|
141
|
+
backup_databases_folder_path = process.env.BACKUP_DATABASES_FOLDER_PATH || 'D:/sendifier database backup';
|
142
|
+
external_http_request_timeout = parseInt(process.env.EXTERNAL_HTTP_REQUEST_TIMEOUT || '5000');
|
143
|
+
}
|
144
|
+
|
145
|
+
export default new Development();
|
@@ -0,0 +1,59 @@
|
|
1
|
+
'use strict';
|
2
|
+
import * as _ from 'lodash';
|
3
|
+
import { IConfig, IConfigProps, EnvironmentVariables } from './config-interface';
|
4
|
+
|
5
|
+
// Load environment variables
|
6
|
+
try {
|
7
|
+
require('dotenv').config();
|
8
|
+
} catch (error) {
|
9
|
+
console.warn('⚠️ dotenv not available, using system environment variables');
|
10
|
+
}
|
11
|
+
|
12
|
+
const env = process.env as EnvironmentVariables;
|
13
|
+
|
14
|
+
// Validate required environment variables
|
15
|
+
const validateEnvironment = () => {
|
16
|
+
const requiredVars = ['NODE_ENV'];
|
17
|
+
const missingVars = requiredVars.filter(varName => !env[varName]);
|
18
|
+
|
19
|
+
if (missingVars.length > 0) {
|
20
|
+
console.warn(`⚠️ Missing environment variables: ${missingVars.join(', ')}`);
|
21
|
+
console.warn(' Using default values. For production, set all required environment variables.');
|
22
|
+
}
|
23
|
+
};
|
24
|
+
|
25
|
+
const envConfig = () => {
|
26
|
+
const nodeEnv = env.NODE_ENV || 'development';
|
27
|
+
console.log(`🚀 Loading API with ${nodeEnv} configuration.`);
|
28
|
+
|
29
|
+
switch (nodeEnv) {
|
30
|
+
case "development": {
|
31
|
+
return require('./development');
|
32
|
+
}
|
33
|
+
case "staging": {
|
34
|
+
return require('./staging');
|
35
|
+
}
|
36
|
+
case "production": {
|
37
|
+
return require('./production');
|
38
|
+
}
|
39
|
+
default: {
|
40
|
+
console.warn(`⚠️ Unknown NODE_ENV: ${nodeEnv}. Using development configuration.`);
|
41
|
+
return require('./development');
|
42
|
+
}
|
43
|
+
}
|
44
|
+
};
|
45
|
+
|
46
|
+
export class Configuration {
|
47
|
+
constructor() {
|
48
|
+
validateEnvironment();
|
49
|
+
}
|
50
|
+
|
51
|
+
LoadConfiguration(): IConfig {
|
52
|
+
return {
|
53
|
+
variables: env,
|
54
|
+
props: envConfig()?.default || require('./development').default
|
55
|
+
};
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
export const Config = new Configuration().LoadConfiguration();
|
@@ -0,0 +1,145 @@
|
|
1
|
+
import { WhatsappProviders, AuthProvider, OAuthProvider } from "../helpers/enums";
|
2
|
+
import { IConfigProps, WhatsappProvidersConfig, AuthConfig } from "./config-interface";
|
3
|
+
|
4
|
+
class Production implements IConfigProps {
|
5
|
+
isDev = false;
|
6
|
+
isProd = true;
|
7
|
+
host_name: string = 'https://api.sendifier.com';
|
8
|
+
port: string = process.env.PORT || '4000';
|
9
|
+
development_environment_url: 'https://humble-macaw-separately.ngrok-free.app'
|
10
|
+
database_connectionstring: string = "mongodb://system_user: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@184.72.123.229:27017/sendifier-production";
|
11
|
+
base_site_url: string = "https://app.sendifier.com";
|
12
|
+
register_complete_page_url: string = "register_complete";
|
13
|
+
whatsapp_default_provider: WhatsappProviders = WhatsappProviders.twilio;
|
14
|
+
whatsapp_providers_configurations = [{
|
15
|
+
key: WhatsappProviders.twilio,
|
16
|
+
value: {
|
17
|
+
provider_type: WhatsappProviders.twilio,
|
18
|
+
account_id: 'AC55b03a222fa486300e5791d8f34cfacd',
|
19
|
+
token: 'c3cc0022815391e027b7bf4bac47b46c'
|
20
|
+
}
|
21
|
+
}];
|
22
|
+
firebase_application_config = {
|
23
|
+
apiKey: "AIzaSyCyRHzm2f_CooMRbYpRVV0MpptBu-HdEs4",
|
24
|
+
authDomain: "app.sendifier.com",
|
25
|
+
projectId: "sendifier-web-app",
|
26
|
+
storageBucket: "sendifier-web-app.appspot.com",
|
27
|
+
messagingSenderId: "717324879598",
|
28
|
+
appId: "1:717324879598:web:8d4f09d06c30cc435855ff"
|
29
|
+
};
|
30
|
+
firebase_auth_certification_path = `lib/certs/auth-app-cert.json`;
|
31
|
+
internal_http_request_header_key = 'x-internal-request';
|
32
|
+
internal_http_request_header_value = 'BHQGYqbN(Iu8MjgspaJzHRVSyahvbXuLPT%rI^)FDJ(At@k3vKm3E!Qp%EcJqGDt'
|
33
|
+
http_request_header_requestidentifier_key = 'p-request-identifier';
|
34
|
+
redirect_all_requests_to_local = true;
|
35
|
+
local_api_tunnel_url = "https://humble-macaw-separately.ngrok-free.app";
|
36
|
+
local_ui_tunnel_url = "";
|
37
|
+
load_scheduled_tasks = false;
|
38
|
+
backup_databases_folder_path = "";
|
39
|
+
external_http_request_timeout=5000;
|
40
|
+
|
41
|
+
// Authentication Configuration
|
42
|
+
auth: AuthConfig = {
|
43
|
+
enabled_providers: [AuthProvider.INTERNAL, AuthProvider.FIREBASE, AuthProvider.SMS_OTP, AuthProvider.EMAIL_OTP],
|
44
|
+
default_provider: AuthProvider.INTERNAL,
|
45
|
+
|
46
|
+
jwt: {
|
47
|
+
secret: process.env.JWT_SECRET || 'your-super-secret-jwt-key-change-in-production',
|
48
|
+
expires_in: '24h',
|
49
|
+
refresh_token_expires_in: '7d',
|
50
|
+
issuer: 'diagramers-api',
|
51
|
+
audience: 'diagramers-users'
|
52
|
+
},
|
53
|
+
|
54
|
+
internal: {
|
55
|
+
password_min_length: 8,
|
56
|
+
password_require_uppercase: true,
|
57
|
+
password_require_lowercase: true,
|
58
|
+
password_require_numbers: true,
|
59
|
+
password_require_special_chars: true,
|
60
|
+
max_login_attempts: 5,
|
61
|
+
lockout_duration_minutes: 15,
|
62
|
+
require_email_verification: true,
|
63
|
+
require_phone_verification: false
|
64
|
+
},
|
65
|
+
|
66
|
+
firebase: {
|
67
|
+
enabled: true,
|
68
|
+
project_id: process.env.FIREBASE_PROJECT_ID || "sendifier-web-app",
|
69
|
+
private_key_path: process.env.FIREBASE_PRIVATE_KEY_PATH || "lib/certs/auth-app-cert.json",
|
70
|
+
client_email: process.env.FIREBASE_CLIENT_EMAIL || "",
|
71
|
+
api_key: process.env.FIREBASE_API_KEY || "AIzaSyCyRHzm2f_CooMRbYpRVV0MpptBu-HdEs4",
|
72
|
+
auth_domain: process.env.FIREBASE_AUTH_DOMAIN || "app.sendifier.com",
|
73
|
+
storage_bucket: process.env.FIREBASE_STORAGE_BUCKET || "sendifier-web-app.appspot.com",
|
74
|
+
messaging_sender_id: process.env.FIREBASE_MESSAGING_SENDER_ID || "717324879598",
|
75
|
+
app_id: process.env.FIREBASE_APP_ID || "1:717324879598:web:8d4f09d06c30cc435855ff"
|
76
|
+
},
|
77
|
+
|
78
|
+
oauth: {
|
79
|
+
enabled_providers: [OAuthProvider.GOOGLE, OAuthProvider.FACEBOOK, OAuthProvider.GITHUB],
|
80
|
+
providers: {
|
81
|
+
[OAuthProvider.GOOGLE]: {
|
82
|
+
client_id: process.env.GOOGLE_CLIENT_ID || "",
|
83
|
+
client_secret: process.env.GOOGLE_CLIENT_SECRET || "",
|
84
|
+
redirect_uri: process.env.GOOGLE_REDIRECT_URI || "https://api.sendifier.com/auth/google/callback",
|
85
|
+
scope: ['email', 'profile'],
|
86
|
+
enabled: true
|
87
|
+
},
|
88
|
+
[OAuthProvider.FACEBOOK]: {
|
89
|
+
client_id: process.env.FACEBOOK_CLIENT_ID || "",
|
90
|
+
client_secret: process.env.FACEBOOK_CLIENT_SECRET || "",
|
91
|
+
redirect_uri: process.env.FACEBOOK_REDIRECT_URI || "https://api.sendifier.com/auth/facebook/callback",
|
92
|
+
scope: ['email', 'public_profile'],
|
93
|
+
enabled: true
|
94
|
+
},
|
95
|
+
[OAuthProvider.GITHUB]: {
|
96
|
+
client_id: process.env.GITHUB_CLIENT_ID || "",
|
97
|
+
client_secret: process.env.GITHUB_CLIENT_SECRET || "",
|
98
|
+
redirect_uri: process.env.GITHUB_REDIRECT_URI || "https://api.sendifier.com/auth/github/callback",
|
99
|
+
scope: ['user:email'],
|
100
|
+
enabled: true
|
101
|
+
}
|
102
|
+
},
|
103
|
+
callback_url: "https://api.sendifier.com/auth/callback",
|
104
|
+
state_secret: process.env.OAUTH_STATE_SECRET || "your-oauth-state-secret"
|
105
|
+
},
|
106
|
+
|
107
|
+
sms_otp: {
|
108
|
+
enabled: true,
|
109
|
+
provider: 'twilio',
|
110
|
+
twilio: {
|
111
|
+
account_sid: process.env.TWILIO_ACCOUNT_SID || 'AC55b03a222fa486300e5791d8f34cfacd',
|
112
|
+
auth_token: process.env.TWILIO_AUTH_TOKEN || 'c3cc0022815391e027b7bf4bac47b46c',
|
113
|
+
from_number: process.env.TWILIO_FROM_NUMBER || '+1234567890'
|
114
|
+
},
|
115
|
+
otp_length: 6,
|
116
|
+
otp_expiry_minutes: 10,
|
117
|
+
max_attempts: 3
|
118
|
+
},
|
119
|
+
|
120
|
+
email_otp: {
|
121
|
+
enabled: true,
|
122
|
+
smtp: {
|
123
|
+
host: process.env.SMTP_HOST || 'smtp.gmail.com',
|
124
|
+
port: parseInt(process.env.SMTP_PORT || '587'),
|
125
|
+
secure: false,
|
126
|
+
user: process.env.SMTP_USER || 'your-email@gmail.com',
|
127
|
+
pass: process.env.SMTP_PASS || 'your-app-password'
|
128
|
+
},
|
129
|
+
otp_length: 6,
|
130
|
+
otp_expiry_minutes: 15,
|
131
|
+
max_attempts: 3,
|
132
|
+
from_email: process.env.FROM_EMAIL || 'noreply@diagramers.com',
|
133
|
+
from_name: process.env.FROM_NAME || 'Diagramers'
|
134
|
+
},
|
135
|
+
|
136
|
+
session: {
|
137
|
+
max_sessions_per_user: 5,
|
138
|
+
session_timeout_minutes: 1440, // 24 hours
|
139
|
+
remember_me_days: 30,
|
140
|
+
concurrent_login_allowed: true
|
141
|
+
}
|
142
|
+
};
|
143
|
+
|
144
|
+
};
|
145
|
+
export default new Production();
|
@@ -0,0 +1,144 @@
|
|
1
|
+
import { WhatsappProviders, AuthProvider, OAuthProvider } from "../helpers/enums";
|
2
|
+
import { IConfigProps, WhatsappProvidersConfig, AuthConfig } from "./config-interface";
|
3
|
+
|
4
|
+
class Staging implements IConfigProps {
|
5
|
+
isDev = false;
|
6
|
+
isProd = true;
|
7
|
+
host_name: string = 'https://api-staging.sendifier.com';
|
8
|
+
port: string = process.env.PORT || '8000';
|
9
|
+
development_environment_url: 'https://humble-macaw-separately.ngrok-free.app'
|
10
|
+
database_connectionstring: string = "mongodb://system_user:ghp_OJWuVhmI423rew23YJMNp7gXxAlBL00UEpYa@184.72.123.229:27017/sendifier-staging";
|
11
|
+
base_site_url: string = "https://app.sendifier.com";
|
12
|
+
register_complete_page_url: string = "register_complete";
|
13
|
+
whatsapp_default_provider: WhatsappProviders = WhatsappProviders.twilio;
|
14
|
+
whatsapp_providers_configurations = [{
|
15
|
+
key: WhatsappProviders.twilio,
|
16
|
+
value: {
|
17
|
+
provider_type: WhatsappProviders.twilio,
|
18
|
+
account_id: 'AC55b03a222fa486300e5791d8f34cfacd',
|
19
|
+
token: 'c3cc0022815391e027b7bf4bac47b46c'
|
20
|
+
}
|
21
|
+
}];
|
22
|
+
firebase_application_config = {
|
23
|
+
apiKey: "AIzaSyCyRHzm2f_CooMRbYpRVV0MpptBu-HdEs4",
|
24
|
+
authDomain: "app.sendifier.com",
|
25
|
+
projectId: "sendifier-web-app",
|
26
|
+
storageBucket: "sendifier-web-app.appspot.com",
|
27
|
+
messagingSenderId: "717324879598",
|
28
|
+
appId: "1:717324879598:web:8d4f09d06c30cc435855ff"
|
29
|
+
};
|
30
|
+
firebase_auth_certification_path = `lib/certs/auth-app-cert.json`;
|
31
|
+
internal_http_request_header_key = 'x-internal-request';
|
32
|
+
internal_http_request_header_value = 'BHQGYqbN(Iu8MjgspaJzHRVSyahvbXuLPT%rI^)FDJ(At@k3vKm3E!Qp%EcJqGDt'
|
33
|
+
http_request_header_requestidentifier_key = 'p-request-identifier';
|
34
|
+
redirect_all_requests_to_local = false;
|
35
|
+
local_api_tunnel_url = "https://humble-macaw-separately.ngrok-free.app";
|
36
|
+
local_ui_tunnel_url = "";
|
37
|
+
load_scheduled_tasks = false;
|
38
|
+
backup_databases_folder_path = "";
|
39
|
+
external_http_request_timeout = 10000;
|
40
|
+
|
41
|
+
// Authentication Configuration
|
42
|
+
auth: AuthConfig = {
|
43
|
+
enabled_providers: [AuthProvider.INTERNAL, AuthProvider.FIREBASE, AuthProvider.SMS_OTP, AuthProvider.EMAIL_OTP],
|
44
|
+
default_provider: AuthProvider.INTERNAL,
|
45
|
+
|
46
|
+
jwt: {
|
47
|
+
secret: process.env.JWT_SECRET || 'your-super-secret-jwt-key-change-in-production',
|
48
|
+
expires_in: '24h',
|
49
|
+
refresh_token_expires_in: '7d',
|
50
|
+
issuer: 'diagramers-api',
|
51
|
+
audience: 'diagramers-users'
|
52
|
+
},
|
53
|
+
|
54
|
+
internal: {
|
55
|
+
password_min_length: 8,
|
56
|
+
password_require_uppercase: true,
|
57
|
+
password_require_lowercase: true,
|
58
|
+
password_require_numbers: true,
|
59
|
+
password_require_special_chars: true,
|
60
|
+
max_login_attempts: 5,
|
61
|
+
lockout_duration_minutes: 15,
|
62
|
+
require_email_verification: true,
|
63
|
+
require_phone_verification: false
|
64
|
+
},
|
65
|
+
|
66
|
+
firebase: {
|
67
|
+
enabled: true,
|
68
|
+
project_id: process.env.FIREBASE_PROJECT_ID || "sendifier-web-app",
|
69
|
+
private_key_path: process.env.FIREBASE_PRIVATE_KEY_PATH || "lib/certs/auth-app-cert.json",
|
70
|
+
client_email: process.env.FIREBASE_CLIENT_EMAIL || "",
|
71
|
+
api_key: process.env.FIREBASE_API_KEY || "AIzaSyCyRHzm2f_CooMRbYpRVV0MpptBu-HdEs4",
|
72
|
+
auth_domain: process.env.FIREBASE_AUTH_DOMAIN || "app.sendifier.com",
|
73
|
+
storage_bucket: process.env.FIREBASE_STORAGE_BUCKET || "sendifier-web-app.appspot.com",
|
74
|
+
messaging_sender_id: process.env.FIREBASE_MESSAGING_SENDER_ID || "717324879598",
|
75
|
+
app_id: process.env.FIREBASE_APP_ID || "1:717324879598:web:8d4f09d06c30cc435855ff"
|
76
|
+
},
|
77
|
+
|
78
|
+
oauth: {
|
79
|
+
enabled_providers: [OAuthProvider.GOOGLE, OAuthProvider.FACEBOOK, OAuthProvider.GITHUB],
|
80
|
+
providers: {
|
81
|
+
[OAuthProvider.GOOGLE]: {
|
82
|
+
client_id: process.env.GOOGLE_CLIENT_ID || "",
|
83
|
+
client_secret: process.env.GOOGLE_CLIENT_SECRET || "",
|
84
|
+
redirect_uri: process.env.GOOGLE_REDIRECT_URI || "https://api-staging.sendifier.com/auth/google/callback",
|
85
|
+
scope: ['email', 'profile'],
|
86
|
+
enabled: true
|
87
|
+
},
|
88
|
+
[OAuthProvider.FACEBOOK]: {
|
89
|
+
client_id: process.env.FACEBOOK_CLIENT_ID || "",
|
90
|
+
client_secret: process.env.FACEBOOK_CLIENT_SECRET || "",
|
91
|
+
redirect_uri: process.env.FACEBOOK_REDIRECT_URI || "https://api-staging.sendifier.com/auth/facebook/callback",
|
92
|
+
scope: ['email', 'public_profile'],
|
93
|
+
enabled: true
|
94
|
+
},
|
95
|
+
[OAuthProvider.GITHUB]: {
|
96
|
+
client_id: process.env.GITHUB_CLIENT_ID || "",
|
97
|
+
client_secret: process.env.GITHUB_CLIENT_SECRET || "",
|
98
|
+
redirect_uri: process.env.GITHUB_REDIRECT_URI || "https://api-staging.sendifier.com/auth/github/callback",
|
99
|
+
scope: ['user:email'],
|
100
|
+
enabled: true
|
101
|
+
}
|
102
|
+
},
|
103
|
+
callback_url: "https://api-staging.sendifier.com/auth/callback",
|
104
|
+
state_secret: process.env.OAUTH_STATE_SECRET || "your-oauth-state-secret"
|
105
|
+
},
|
106
|
+
|
107
|
+
sms_otp: {
|
108
|
+
enabled: true,
|
109
|
+
provider: 'twilio',
|
110
|
+
twilio: {
|
111
|
+
account_sid: process.env.TWILIO_ACCOUNT_SID || 'AC55b03a222fa486300e5791d8f34cfacd',
|
112
|
+
auth_token: process.env.TWILIO_AUTH_TOKEN || 'c3cc0022815391e027b7bf4bac47b46c',
|
113
|
+
from_number: process.env.TWILIO_FROM_NUMBER || '+1234567890'
|
114
|
+
},
|
115
|
+
otp_length: 6,
|
116
|
+
otp_expiry_minutes: 10,
|
117
|
+
max_attempts: 3
|
118
|
+
},
|
119
|
+
|
120
|
+
email_otp: {
|
121
|
+
enabled: true,
|
122
|
+
smtp: {
|
123
|
+
host: process.env.SMTP_HOST || 'smtp.gmail.com',
|
124
|
+
port: parseInt(process.env.SMTP_PORT || '587'),
|
125
|
+
secure: false,
|
126
|
+
user: process.env.SMTP_USER || 'your-email@gmail.com',
|
127
|
+
pass: process.env.SMTP_PASS || 'your-app-password'
|
128
|
+
},
|
129
|
+
otp_length: 6,
|
130
|
+
otp_expiry_minutes: 15,
|
131
|
+
max_attempts: 3,
|
132
|
+
from_email: process.env.FROM_EMAIL || 'noreply@diagramers.com',
|
133
|
+
from_name: process.env.FROM_NAME || 'Diagramers'
|
134
|
+
},
|
135
|
+
|
136
|
+
session: {
|
137
|
+
max_sessions_per_user: 5,
|
138
|
+
session_timeout_minutes: 1440, // 24 hours
|
139
|
+
remember_me_days: 30,
|
140
|
+
concurrent_login_allowed: true
|
141
|
+
}
|
142
|
+
};
|
143
|
+
};
|
144
|
+
export default new Staging();
|
@@ -0,0 +1,144 @@
|
|
1
|
+
import { WhatsappProviders, AuthProvider, OAuthProvider } from "../helpers/enums";
|
2
|
+
import { IConfigProps, WhatsappProvidersConfig, AuthConfig } from "./config-interface";
|
3
|
+
|
4
|
+
class Staging implements IConfigProps {
|
5
|
+
isDev = false;
|
6
|
+
isProd = true;
|
7
|
+
host_name: string = 'https://api-staging.sendifier.com';
|
8
|
+
port: string = process.env.PORT || '8000';
|
9
|
+
development_environment_url: 'https://humble-macaw-separately.ngrok-free.app'
|
10
|
+
database_connectionstring: string = "mongodb://system_user:ghp_OJWuVhmI423rew23YJMNp7gXxAlBL00UEpYa@184.72.123.229:27017/sendifier-staging";
|
11
|
+
base_site_url: string = "https://app.sendifier.com";
|
12
|
+
register_complete_page_url: string = "register_complete";
|
13
|
+
whatsapp_default_provider: WhatsappProviders = WhatsappProviders.twilio;
|
14
|
+
whatsapp_providers_configurations = [{
|
15
|
+
key: WhatsappProviders.twilio,
|
16
|
+
value: {
|
17
|
+
provider_type: WhatsappProviders.twilio,
|
18
|
+
account_id: 'AC55b03a222fa486300e5791d8f34cfacd',
|
19
|
+
token: 'c3cc0022815391e027b7bf4bac47b46c'
|
20
|
+
}
|
21
|
+
}];
|
22
|
+
firebase_application_config = {
|
23
|
+
apiKey: "AIzaSyCyRHzm2f_CooMRbYpRVV0MpptBu-HdEs4",
|
24
|
+
authDomain: "app.sendifier.com",
|
25
|
+
projectId: "sendifier-web-app",
|
26
|
+
storageBucket: "sendifier-web-app.appspot.com",
|
27
|
+
messagingSenderId: "717324879598",
|
28
|
+
appId: "1:717324879598:web:8d4f09d06c30cc435855ff"
|
29
|
+
};
|
30
|
+
firebase_auth_certification_path = `lib/certs/auth-app-cert.json`;
|
31
|
+
internal_http_request_header_key = 'x-internal-request';
|
32
|
+
internal_http_request_header_value = 'BHQGYqbN(Iu8MjgspaJzHRVSyahvbXuLPT%rI^)FDJ(At@k3vKm3E!Qp%EcJqGDt'
|
33
|
+
http_request_header_requestidentifier_key = 'p-request-identifier';
|
34
|
+
redirect_all_requests_to_local = false;
|
35
|
+
local_api_tunnel_url = "https://humble-macaw-separately.ngrok-free.app";
|
36
|
+
local_ui_tunnel_url = "";
|
37
|
+
load_scheduled_tasks = false;
|
38
|
+
backup_databases_folder_path = "";
|
39
|
+
external_http_request_timeout = 10000;
|
40
|
+
|
41
|
+
// Authentication Configuration
|
42
|
+
auth: AuthConfig = {
|
43
|
+
enabled_providers: [AuthProvider.INTERNAL, AuthProvider.FIREBASE, AuthProvider.SMS_OTP, AuthProvider.EMAIL_OTP],
|
44
|
+
default_provider: AuthProvider.INTERNAL,
|
45
|
+
|
46
|
+
jwt: {
|
47
|
+
secret: process.env.JWT_SECRET || 'your-super-secret-jwt-key-change-in-production',
|
48
|
+
expires_in: '24h',
|
49
|
+
refresh_token_expires_in: '7d',
|
50
|
+
issuer: 'diagramers-api',
|
51
|
+
audience: 'diagramers-users'
|
52
|
+
},
|
53
|
+
|
54
|
+
internal: {
|
55
|
+
password_min_length: 8,
|
56
|
+
password_require_uppercase: true,
|
57
|
+
password_require_lowercase: true,
|
58
|
+
password_require_numbers: true,
|
59
|
+
password_require_special_chars: true,
|
60
|
+
max_login_attempts: 5,
|
61
|
+
lockout_duration_minutes: 15,
|
62
|
+
require_email_verification: true,
|
63
|
+
require_phone_verification: false
|
64
|
+
},
|
65
|
+
|
66
|
+
firebase: {
|
67
|
+
enabled: true,
|
68
|
+
project_id: process.env.FIREBASE_PROJECT_ID || "sendifier-web-app",
|
69
|
+
private_key_path: process.env.FIREBASE_PRIVATE_KEY_PATH || "lib/certs/auth-app-cert.json",
|
70
|
+
client_email: process.env.FIREBASE_CLIENT_EMAIL || "",
|
71
|
+
api_key: process.env.FIREBASE_API_KEY || "AIzaSyCyRHzm2f_CooMRbYpRVV0MpptBu-HdEs4",
|
72
|
+
auth_domain: process.env.FIREBASE_AUTH_DOMAIN || "app.sendifier.com",
|
73
|
+
storage_bucket: process.env.FIREBASE_STORAGE_BUCKET || "sendifier-web-app.appspot.com",
|
74
|
+
messaging_sender_id: process.env.FIREBASE_MESSAGING_SENDER_ID || "717324879598",
|
75
|
+
app_id: process.env.FIREBASE_APP_ID || "1:717324879598:web:8d4f09d06c30cc435855ff"
|
76
|
+
},
|
77
|
+
|
78
|
+
oauth: {
|
79
|
+
enabled_providers: [OAuthProvider.GOOGLE, OAuthProvider.FACEBOOK, OAuthProvider.GITHUB],
|
80
|
+
providers: {
|
81
|
+
[OAuthProvider.GOOGLE]: {
|
82
|
+
client_id: process.env.GOOGLE_CLIENT_ID || "",
|
83
|
+
client_secret: process.env.GOOGLE_CLIENT_SECRET || "",
|
84
|
+
redirect_uri: process.env.GOOGLE_REDIRECT_URI || "https://api-uat.sendifier.com/auth/google/callback",
|
85
|
+
scope: ['email', 'profile'],
|
86
|
+
enabled: true
|
87
|
+
},
|
88
|
+
[OAuthProvider.FACEBOOK]: {
|
89
|
+
client_id: process.env.FACEBOOK_CLIENT_ID || "",
|
90
|
+
client_secret: process.env.FACEBOOK_CLIENT_SECRET || "",
|
91
|
+
redirect_uri: process.env.FACEBOOK_REDIRECT_URI || "https://api-uat.sendifier.com/auth/facebook/callback",
|
92
|
+
scope: ['email', 'public_profile'],
|
93
|
+
enabled: true
|
94
|
+
},
|
95
|
+
[OAuthProvider.GITHUB]: {
|
96
|
+
client_id: process.env.GITHUB_CLIENT_ID || "",
|
97
|
+
client_secret: process.env.GITHUB_CLIENT_SECRET || "",
|
98
|
+
redirect_uri: process.env.GITHUB_REDIRECT_URI || "https://api-uat.sendifier.com/auth/github/callback",
|
99
|
+
scope: ['user:email'],
|
100
|
+
enabled: true
|
101
|
+
}
|
102
|
+
},
|
103
|
+
callback_url: "https://api-uat.sendifier.com/auth/callback",
|
104
|
+
state_secret: process.env.OAUTH_STATE_SECRET || "your-oauth-state-secret"
|
105
|
+
},
|
106
|
+
|
107
|
+
sms_otp: {
|
108
|
+
enabled: true,
|
109
|
+
provider: 'twilio',
|
110
|
+
twilio: {
|
111
|
+
account_sid: process.env.TWILIO_ACCOUNT_SID || 'AC55b03a222fa486300e5791d8f34cfacd',
|
112
|
+
auth_token: process.env.TWILIO_AUTH_TOKEN || 'c3cc0022815391e027b7bf4bac47b46c',
|
113
|
+
from_number: process.env.TWILIO_FROM_NUMBER || '+1234567890'
|
114
|
+
},
|
115
|
+
otp_length: 6,
|
116
|
+
otp_expiry_minutes: 10,
|
117
|
+
max_attempts: 3
|
118
|
+
},
|
119
|
+
|
120
|
+
email_otp: {
|
121
|
+
enabled: true,
|
122
|
+
smtp: {
|
123
|
+
host: process.env.SMTP_HOST || 'smtp.gmail.com',
|
124
|
+
port: parseInt(process.env.SMTP_PORT || '587'),
|
125
|
+
secure: false,
|
126
|
+
user: process.env.SMTP_USER || 'your-email@gmail.com',
|
127
|
+
pass: process.env.SMTP_PASS || 'your-app-password'
|
128
|
+
},
|
129
|
+
otp_length: 6,
|
130
|
+
otp_expiry_minutes: 15,
|
131
|
+
max_attempts: 3,
|
132
|
+
from_email: process.env.FROM_EMAIL || 'noreply@diagramers.com',
|
133
|
+
from_name: process.env.FROM_NAME || 'Diagramers'
|
134
|
+
},
|
135
|
+
|
136
|
+
session: {
|
137
|
+
max_sessions_per_user: 5,
|
138
|
+
session_timeout_minutes: 1440, // 24 hours
|
139
|
+
remember_me_days: 30,
|
140
|
+
concurrent_login_allowed: true
|
141
|
+
}
|
142
|
+
};
|
143
|
+
};
|
144
|
+
export default new Staging();
|