()
| 278 | } |
| 279 | |
| 280 | getAppDefinitions() { |
| 281 | const self = this |
| 282 | return new Promise<IAllAppDefinitions>(function (resolve, reject) { |
| 283 | const allApps = self.data.get(APP_DEFINITIONS) || {} |
| 284 | const allAppsUnencrypted: IAllAppDefinitions = {} |
| 285 | |
| 286 | Object.keys(allApps).forEach(function (appName) { |
| 287 | allAppsUnencrypted[appName] = allApps[appName] |
| 288 | const appUnencrypted = allAppsUnencrypted[appName] |
| 289 | |
| 290 | // captainDefinitionFilePath added in v1.2.0, we need to backfill if it doesn't exists. |
| 291 | appUnencrypted.captainDefinitionRelativeFilePath = |
| 292 | appUnencrypted.captainDefinitionRelativeFilePath || |
| 293 | CaptainConstants.defaultCaptainDefinitionPath |
| 294 | |
| 295 | const appSave = allApps[appName] as IAppDefSaved |
| 296 | |
| 297 | if ( |
| 298 | appSave.appPushWebhook && |
| 299 | appSave.appPushWebhook.repoInfo && |
| 300 | (appSave.appPushWebhook.repoInfo.passwordEncrypted || |
| 301 | appSave.appPushWebhook.repoInfo.sshKeyEncrypted) |
| 302 | ) { |
| 303 | const repo = appSave.appPushWebhook!.repoInfo |
| 304 | appUnencrypted.appPushWebhook = { |
| 305 | tokenVersion: appSave.appPushWebhook.tokenVersion, |
| 306 | pushWebhookToken: |
| 307 | appSave.appPushWebhook.pushWebhookToken, |
| 308 | repoInfo: { |
| 309 | repo: repo.repo, |
| 310 | user: repo.user, |
| 311 | password: repo.passwordEncrypted |
| 312 | ? self.encryptor.decrypt(repo.passwordEncrypted) |
| 313 | : '', |
| 314 | sshKey: repo.sshKeyEncrypted |
| 315 | ? self.encryptor.decrypt(repo.sshKeyEncrypted) |
| 316 | : '', |
| 317 | branch: repo.branch, |
| 318 | }, |
| 319 | } |
| 320 | } |
| 321 | }) |
| 322 | resolve(JSON.parse(JSON.stringify(allAppsUnencrypted))) |
| 323 | }) |
| 324 | } |
| 325 | |
| 326 | getAppDefinition(appName: string) { |
| 327 | return this.getAppDefinitions().then(function (allApps) { |
no test coverage detected