|
1 |
| -import { Validator, ConfigSchema } from './env-validation'; |
| 1 | +import { ConfigSchema } from './env-validation'; |
| 2 | + |
| 3 | +import { Validator } from './Validator'; |
2 | 4 |
|
3 | 5 | // --------------------------------------------------------------------------------
|
4 | 6 |
|
5 | 7 | const v = new Validator();
|
6 | 8 |
|
7 | 9 | const mySchema = new ConfigSchema({
|
8 |
| - API_GATEWAY_PROTOCOL: v.protocol, |
9 |
| - API_GATEWAY_HOST: v.host, |
10 |
| - API_GATEWAY_PORT: v.port, |
11 |
| - API_GATEWAY_PROTOCOL_SECURE: v.protocol, |
12 |
| - API_ENDPOINT: v.endpoint, |
13 |
| - |
14 |
| - FRONT_END_URL: v.url, |
15 |
| - |
16 |
| - MOBILE_APP: v.exists, |
17 |
| - MOBILE_APP_NAME: v.exists, |
18 |
| - MOBILE_APP_DOWNLOAD_URL: v.url, |
19 |
| - PLAY_STORE_DOWNLOAD_LINK: v.url, |
20 |
| - IOS_DOWNLOAD_LINK: v.url, |
21 |
| - |
22 |
| - PLATFORM_NAME: v.exists, |
23 |
| - POWERED_BY: v.exists, |
24 |
| - PLATFORM_WEB_URL: v.url, |
25 |
| - POWERED_BY_URL: v.url, |
26 |
| - UPLOAD_LOGO_HOST: v.host, |
27 |
| - BRAND_LOGO: v.url, |
28 |
| - PLATFORM_ADMIN_EMAIL: v.email, |
29 |
| - |
30 |
| - SOCKET_HOST: v.host |
| 10 | + API_GATEWAY_PROTOCOL: { method: v.protocol }, |
| 11 | + API_GATEWAY_HOST: { method: v.host }, |
| 12 | + API_GATEWAY_PORT: { method: v.port }, |
| 13 | + API_GATEWAY_PROTOCOL_SECURE: { method: v.protocol }, |
| 14 | + API_ENDPOINT: { method: v.endpoint }, |
| 15 | + |
| 16 | + FRONT_END_URL: { method: v.url }, |
| 17 | + |
| 18 | + MOBILE_APP: { method: v.notEmpty }, |
| 19 | + MOBILE_APP_NAME: { method: v.notEmpty }, |
| 20 | + MOBILE_APP_DOWNLOAD_URL: { method: v.url }, |
| 21 | + PLAY_STORE_DOWNLOAD_LINK: { method: v.url }, // tiene forma concret}a |
| 22 | + IOS_DOWNLOAD_LINK: { method: v.url }, // tiene forma concret}a |
| 23 | + |
| 24 | + PLATFORM_NAME: { method: v.notEmpty }, |
| 25 | + POWERED_BY: { method: v.notEmpty }, |
| 26 | + PLATFORM_WEB_URL: { method: v.url }, |
| 27 | + POWERED_BY_URL: { method: v.url }, |
| 28 | + UPLOAD_LOGO_HOST: { method: v.host }, |
| 29 | + BRAND_LOGO: { method: v.url }, |
| 30 | + PLATFORM_ADMIN_EMAIL: { method: v.email }, |
| 31 | + |
| 32 | + SOCKET_HOST: { method: v.host }, |
| 33 | + |
| 34 | + NATS_HOST: { method: v.host }, |
| 35 | + NATS_PORT: { method: v.port }, |
| 36 | + NATS_URL: { method: v.url }, |
| 37 | + |
| 38 | + REDIS_HOST: { method: v.host }, |
| 39 | + REDIS_PORT: { method: v.port }, |
| 40 | + |
| 41 | + WALLET_STORAGE_HOST: { method: v.host }, |
| 42 | + WALLET_STORAGE_PORT: { method: v.port }, |
| 43 | + WALLET_STORAGE_USER: { method: v.notEmpty }, |
| 44 | + WALLET_STORAGE_PASSWORD: { method: v.notEmpty }, |
| 45 | + |
| 46 | + CRYPTO_PRIVATE_KEY: { method: v.notEmpty }, |
| 47 | + PLATFORM_URL: { method: v.url }, // debe tener la forma https://devapi.credebl.i}d |
| 48 | + PLATFORM_PROFILE_MODE: { method: v.notEmpty }, |
| 49 | + |
| 50 | + PUBLIC_LOCALHOST_URL: { method: v.url }, // tiene que ser localhost sí o s}í |
| 51 | + PUBLIC_DEV_API_URL: { method: v.url }, //en el env tienen una forma específic}a |
| 52 | + PUBLIC_QA_API_URL: { method: v.url }, //en el env tienen una forma específic}a |
| 53 | + PUBLIC_PRODUCTION_API_URL: { method: v.url }, //en el env tienen una forma específic}a |
| 54 | + PUBLIC_SANDBOX_API_URL: { method: v.url }, //en el env tienen una forma específic}a |
| 55 | + PUBLIC_PLATFORM_SUPPORT_EMAIL: { method: v.email }, |
| 56 | + |
| 57 | + AFJ_VERSION: { method: v.notEmpty }, // también tiene una forma concret}a |
| 58 | + |
| 59 | + PLATFORM_WALLET_NAME: { method: v.notEmpty }, |
| 60 | + PLATFORM_WALLET_PASSWORD: { method: v.notEmpty }, |
| 61 | + PLATFORM_SEED: { method: v.notEmpty }, |
| 62 | + PLATFORM_ID: { method: v.number }, |
| 63 | + |
| 64 | + POOL_DATABASE_URL: { method: v.postgresUrl }, // postgre}s |
| 65 | + DATABASE_URL: { method: v.posgresUrl }, |
| 66 | + |
| 67 | + AWS_ACCESS_KEY: { method: v.notEmpty, optional: true }, |
| 68 | + AWS_SECRET_KEY: { method: v.notEmpty, optional: true }, |
| 69 | + AWS_REGION: { method: v.notEmpty, optional: true }, |
| 70 | + AWS_BUCKET: { method: v.notEmpty, optional: true }, |
| 71 | + |
| 72 | + AWS_PUBLIC_ACCESS_KEY: { method: v.notEmpty, optional: true }, |
| 73 | + AWS_PUBLIC_SECRET_KEY: { method: v.notEmpty, optional: true }, |
| 74 | + AWS_PUBLIC_REGION: { method: v.notEmpty, optional: true }, |
| 75 | + AWS_ORG_LOGO_BUCKET_NAME: { method: v.notEmpty, optional: true }, |
| 76 | + |
| 77 | + AWS_S3_STOREOBJECT_ACCESS_KEY: { method: v.notEmpty }, |
| 78 | + AWS_S3_STOREOBJECT_SECRET_KEY: { method: v.notEmpty }, |
| 79 | + AWS_S3_STOREOBJECT_REGION: { method: v.notEmpty }, |
| 80 | + AWS_S3_STOREOBJECT_BUCKET: { method: v.notEmpty }, |
| 81 | + |
| 82 | + SHORTENED_URL_DOMAIN: { method: v.url }, // tiene una forma concret} |
| 83 | + DEEPLINK_DOMAIN: { method: v.notEmpty }, //tiene una forma concret} |
| 84 | + |
| 85 | + ENABLE_CORS_IP_LIST: { method: v.multipleUrl }, |
| 86 | + |
| 87 | + USER_NKEY_SEED: { method: v.notEmpty }, |
| 88 | + API_GATEWAY_NKEY_SEED: { method: v.notEmpty }, |
| 89 | + ORGANIZATION_NKEY_SEED: { method: v.notEmpty }, |
| 90 | + AGENT_PROVISIONING_NKEY_SEED: { method: v.notEmpty }, |
| 91 | + AGENT_SERVICE_NKEY_SEED: { method: v.notEmpty }, |
| 92 | + VERIFICATION_NKEY_SEED: { method: v.notEmpty }, |
| 93 | + LEDGER_NKEY_SEED: { method: v.notEmpty }, |
| 94 | + ISSUANCE_NKEY_SEED: { method: v.notEmpty }, |
| 95 | + CONNECTION_NKEY_SEED: { method: v.notEmpty }, |
| 96 | + ECOSYSTEM_NKEY_SEED: { method: v.notEmpty }, |
| 97 | + CREDENTAILDEFINITION_NKEY_SEED: { method: v.notEmpty }, |
| 98 | + SCHEMA_NKEY_SEED: { method: v.notEmpty }, |
| 99 | + UTILITIES_NKEY_SEED: { method: v.notEmpty }, |
| 100 | + CLOUD_WALLET_NKEY_SEED: { method: v.notEmpty }, |
| 101 | + GEOLOCATION_NKEY_SEED: { method: v.notEmpty }, |
| 102 | + NOTIFICATION_NKEY_SEED: { method: v.notEmpty }, |
| 103 | + |
| 104 | + KEYCLOAK_DOMAIN: { method: v.domain }, |
| 105 | + KEYCLOAK_ADMIN_URL: { method: v.url }, |
| 106 | + KEYCLOAK_MASTER_REALM: { method: v.notEmpty }, |
| 107 | + KEYCLOAK_MANAGEMENT_CLIENT_ID: { method: v.notEmpty }, |
| 108 | + KEYCLOAK_MANAGEMENT_CLIENT_SECRET: { method: v.notEmpty }, |
| 109 | + KEYCLOAK_REALM: { method: v.notEmpty }, |
| 110 | + |
| 111 | + SCHEMA_FILE_SERVER_URL: { method: v.notEmpty }, // tiene una forma concret}a |
| 112 | + SCHEMA_FILE_SERVER_TOKEN: { method: v.notEmpty }, |
| 113 | + |
| 114 | + GEO_LOCATION_MASTER_DATA_IMPORT_SCRIPT: { method: v.location }, |
| 115 | + UPDATE_CLIENT_CREDENTIAL_SCRIPT: { method: v.location }, |
| 116 | + |
| 117 | + AFJ_AGENT_TOKEN_PATH: { method: v.existsLocation }, |
| 118 | + AFJ_AGENT_SPIN_UP: { method: v.existsLocation }, |
| 119 | + AFJ_AGENT_ENDPOINT_PATH: { method: v.existsLocation }, |
| 120 | + |
| 121 | + AFJ_AGENT_TOKEN_PATH: { method: v.location, optional: true }, |
| 122 | + AFJ_AGENT_SPIN_UP: { method: v.location, optional: true }, |
| 123 | + AFJ_AGENT_ENDPOINT_PATH: { method: v.location, optional: true }, |
| 124 | + |
| 125 | + AGENT_PROTOCOL: { method: v.protocol }, |
| 126 | + OOB_BATCH_SIZE: { method: v.number }, |
| 127 | + PROOF_REQ_CONN_LIMIT: { method: v.number }, |
| 128 | + MAX_ORG_LIMIT: { method: v.number }, |
| 129 | + FIDO_API_ENDPOINT: { method: v.endpoint }, |
| 130 | + |
| 131 | + IS_ECOSYSTEM_ENABLE: { method: v.boolean }, |
| 132 | + CONSOLE_LOG_FLAG: { method: v.boolean }, |
| 133 | + ELK_LOG: { method: v.boolean }, |
| 134 | + LOG_LEVEL: { method: v.notEmpty }, |
| 135 | + ELK_LOG_PATH: { method: v.url }, |
| 136 | + ELK_USERNAME: { method: v.notEmpty }, |
| 137 | + ELK_PASSWORD: { method: v.notEmpty }, |
| 138 | + |
| 139 | + ORGANIZATION: { method: v.notEmpty }, |
| 140 | + CONTEXT: { method: v.notEmpty }, |
| 141 | + APP: { method: v.notEmpty } |
31 | 142 | });
|
32 | 143 |
|
33 | 144 | const { errors, success, data } = mySchema.safeParse();
|
|
0 commit comments