envilder 0.7.12 → 0.9.1
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 +284 -37
- package/ROADMAP.md +81 -16
- package/docs/CHANGELOG.md +43 -101
- package/docs/SECURITY.md +26 -2
- package/lib/apps/cli/Cli.d.ts.map +1 -1
- package/lib/apps/cli/Cli.js +68 -11
- package/lib/apps/cli/Cli.js.map +1 -1
- package/lib/apps/cli/Startup.d.ts +3 -9
- package/lib/apps/cli/Startup.d.ts.map +1 -1
- package/lib/apps/cli/Startup.js +4 -54
- package/lib/apps/cli/Startup.js.map +1 -1
- package/lib/apps/gha/Gha.d.ts.map +1 -1
- package/lib/apps/gha/Gha.js +36 -19
- package/lib/apps/gha/Gha.js.map +1 -1
- package/lib/apps/gha/Startup.d.ts +3 -9
- package/lib/apps/gha/Startup.d.ts.map +1 -1
- package/lib/apps/gha/Startup.js +4 -54
- package/lib/apps/gha/Startup.js.map +1 -1
- package/lib/apps/shared/ContainerConfiguration.d.ts +7 -0
- package/lib/apps/shared/ContainerConfiguration.d.ts.map +1 -0
- package/lib/apps/shared/ContainerConfiguration.js +62 -0
- package/lib/apps/shared/ContainerConfiguration.js.map +1 -0
- package/lib/envilder/application/dispatch/DispatchActionCommand.d.ts +2 -2
- package/lib/envilder/application/dispatch/DispatchActionCommand.d.ts.map +1 -1
- package/lib/envilder/application/dispatch/DispatchActionCommand.js +6 -6
- package/lib/envilder/application/dispatch/DispatchActionCommand.js.map +1 -1
- package/lib/envilder/application/dispatch/DispatchActionCommandHandler.d.ts +3 -3
- package/lib/envilder/application/dispatch/DispatchActionCommandHandler.d.ts.map +1 -1
- package/lib/envilder/application/dispatch/DispatchActionCommandHandler.js +13 -13
- package/lib/envilder/application/dispatch/DispatchActionCommandHandler.js.map +1 -1
- package/lib/envilder/application/pullSecretsToEnv/PullSecretsToEnvCommand.d.ts +7 -0
- package/lib/envilder/application/pullSecretsToEnv/PullSecretsToEnvCommand.d.ts.map +1 -0
- package/lib/envilder/application/{pullSsmToEnv/PullSsmToEnvCommand.js → pullSecretsToEnv/PullSecretsToEnvCommand.js} +3 -3
- package/lib/envilder/application/pullSecretsToEnv/PullSecretsToEnvCommand.js.map +1 -0
- package/lib/envilder/application/{pullSsmToEnv/PullSsmToEnvCommandHandler.d.ts → pullSecretsToEnv/PullSecretsToEnvCommandHandler.d.ts} +7 -7
- package/lib/envilder/application/pullSecretsToEnv/PullSecretsToEnvCommandHandler.d.ts.map +1 -0
- package/lib/envilder/application/{pullSsmToEnv/PullSsmToEnvCommandHandler.js → pullSecretsToEnv/PullSecretsToEnvCommandHandler.js} +18 -18
- package/lib/envilder/application/pullSecretsToEnv/PullSecretsToEnvCommandHandler.js.map +1 -0
- package/lib/envilder/application/{pushEnvToSsm/PushEnvToSsmCommand.d.ts → pushEnvToSecrets/PushEnvToSecretsCommand.d.ts} +3 -3
- package/lib/envilder/application/pushEnvToSecrets/PushEnvToSecretsCommand.d.ts.map +1 -0
- package/lib/envilder/application/{pushEnvToSsm/PushEnvToSsmCommand.js → pushEnvToSecrets/PushEnvToSecretsCommand.js} +3 -3
- package/lib/envilder/application/pushEnvToSecrets/PushEnvToSecretsCommand.js.map +1 -0
- package/lib/envilder/application/pushEnvToSecrets/PushEnvToSecretsCommandHandler.d.ts +34 -0
- package/lib/envilder/application/pushEnvToSecrets/PushEnvToSecretsCommandHandler.d.ts.map +1 -0
- package/lib/envilder/application/{pushEnvToSsm/PushEnvToSsmCommandHandler.js → pushEnvToSecrets/PushEnvToSecretsCommandHandler.js} +36 -32
- package/lib/envilder/application/pushEnvToSecrets/PushEnvToSecretsCommandHandler.js.map +1 -0
- package/lib/envilder/application/pushSingle/PushSingleCommand.d.ts +3 -3
- package/lib/envilder/application/pushSingle/PushSingleCommand.d.ts.map +1 -1
- package/lib/envilder/application/pushSingle/PushSingleCommand.js +4 -4
- package/lib/envilder/application/pushSingle/PushSingleCommand.js.map +1 -1
- package/lib/envilder/application/pushSingle/PushSingleCommandHandler.d.ts +2 -2
- package/lib/envilder/application/pushSingle/PushSingleCommandHandler.d.ts.map +1 -1
- package/lib/envilder/application/pushSingle/PushSingleCommandHandler.js +6 -6
- package/lib/envilder/application/pushSingle/PushSingleCommandHandler.js.map +1 -1
- package/lib/envilder/domain/CliOptions.d.ts +3 -3
- package/lib/envilder/domain/CliOptions.d.ts.map +1 -1
- package/lib/envilder/domain/EnvironmentVariable.d.ts +5 -0
- package/lib/envilder/domain/EnvironmentVariable.d.ts.map +1 -1
- package/lib/envilder/domain/EnvironmentVariable.js +12 -3
- package/lib/envilder/domain/EnvironmentVariable.js.map +1 -1
- package/lib/envilder/domain/MapFileConfig.d.ts +10 -0
- package/lib/envilder/domain/MapFileConfig.d.ts.map +1 -0
- package/lib/envilder/domain/MapFileConfig.js +2 -0
- package/lib/envilder/domain/MapFileConfig.js.map +1 -0
- package/lib/envilder/domain/OperationMode.d.ts +2 -2
- package/lib/envilder/domain/OperationMode.d.ts.map +1 -1
- package/lib/envilder/domain/OperationMode.js +2 -2
- package/lib/envilder/domain/OperationMode.js.map +1 -1
- package/lib/envilder/domain/ports/IVariableStore.d.ts +2 -0
- package/lib/envilder/domain/ports/IVariableStore.d.ts.map +1 -1
- package/lib/envilder/infrastructure/aws/AwsSecretProviderFactory.d.ts +4 -0
- package/lib/envilder/infrastructure/aws/AwsSecretProviderFactory.d.ts.map +1 -0
- package/lib/envilder/infrastructure/aws/AwsSecretProviderFactory.js +10 -0
- package/lib/envilder/infrastructure/aws/AwsSecretProviderFactory.js.map +1 -0
- package/lib/envilder/infrastructure/aws/AwsSsmSecretProvider.d.ts.map +1 -1
- package/lib/envilder/infrastructure/aws/AwsSsmSecretProvider.js +3 -1
- package/lib/envilder/infrastructure/aws/AwsSsmSecretProvider.js.map +1 -1
- package/lib/envilder/infrastructure/azure/AzureKeyVaultSecretProvider.d.ts +17 -0
- package/lib/envilder/infrastructure/azure/AzureKeyVaultSecretProvider.d.ts.map +1 -0
- package/lib/envilder/infrastructure/azure/AzureKeyVaultSecretProvider.js +113 -0
- package/lib/envilder/infrastructure/azure/AzureKeyVaultSecretProvider.js.map +1 -0
- package/lib/envilder/infrastructure/azure/AzureSecretProviderFactory.d.ts +9 -0
- package/lib/envilder/infrastructure/azure/AzureSecretProviderFactory.d.ts.map +1 -0
- package/lib/envilder/infrastructure/azure/AzureSecretProviderFactory.js +24 -0
- package/lib/envilder/infrastructure/azure/AzureSecretProviderFactory.js.map +1 -0
- package/lib/envilder/infrastructure/azure/AzureVaultUrlValidator.d.ts +3 -0
- package/lib/envilder/infrastructure/azure/AzureVaultUrlValidator.d.ts.map +1 -0
- package/lib/envilder/infrastructure/azure/AzureVaultUrlValidator.js +28 -0
- package/lib/envilder/infrastructure/azure/AzureVaultUrlValidator.js.map +1 -0
- package/lib/envilder/infrastructure/variableStore/FileVariableStore.d.ts +4 -0
- package/lib/envilder/infrastructure/variableStore/FileVariableStore.d.ts.map +1 -1
- package/lib/envilder/infrastructure/variableStore/FileVariableStore.js +46 -0
- package/lib/envilder/infrastructure/variableStore/FileVariableStore.js.map +1 -1
- package/lib/envilder/types.d.ts +4 -4
- package/lib/envilder/types.js +2 -2
- package/lib/envilder/types.js.map +1 -1
- package/lib/iac/bin/main.d.ts +28 -0
- package/lib/iac/bin/main.d.ts.map +1 -0
- package/lib/iac/bin/main.js +201 -0
- package/lib/iac/bin/main.js.map +1 -0
- package/lib/iac/lib/core/types.d.ts +5 -0
- package/lib/iac/lib/core/types.d.ts.map +1 -0
- package/lib/iac/lib/core/types.js +9 -0
- package/lib/iac/lib/core/types.js.map +1 -0
- package/lib/iac/lib/stacks/customStack.d.ts +23 -0
- package/lib/iac/lib/stacks/customStack.d.ts.map +1 -0
- package/lib/iac/lib/stacks/customStack.js +34 -0
- package/lib/iac/lib/stacks/customStack.js.map +1 -0
- package/lib/iac/lib/stacks/staticWebsiteStack.d.ts +10 -0
- package/lib/iac/lib/stacks/staticWebsiteStack.d.ts.map +1 -0
- package/lib/iac/lib/stacks/staticWebsiteStack.js +163 -0
- package/lib/iac/lib/stacks/staticWebsiteStack.js.map +1 -0
- package/lib/iac/lib/stacks/utils.d.ts +6 -0
- package/lib/iac/lib/stacks/utils.d.ts.map +1 -0
- package/lib/iac/lib/stacks/utils.js +18 -0
- package/lib/iac/lib/stacks/utils.js.map +1 -0
- package/package.json +33 -23
- package/lib/envilder/application/pullSsmToEnv/PullSsmToEnvCommand.d.ts +0 -7
- package/lib/envilder/application/pullSsmToEnv/PullSsmToEnvCommand.d.ts.map +0 -1
- package/lib/envilder/application/pullSsmToEnv/PullSsmToEnvCommand.js.map +0 -1
- package/lib/envilder/application/pullSsmToEnv/PullSsmToEnvCommandHandler.d.ts.map +0 -1
- package/lib/envilder/application/pullSsmToEnv/PullSsmToEnvCommandHandler.js.map +0 -1
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommand.d.ts.map +0 -1
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommand.js.map +0 -1
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.d.ts +0 -34
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.d.ts.map +0 -1
- package/lib/envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.js.map +0 -1
package/docs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
## [0.8.0] - 2026-03-22
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
* **`$config` section in map files** — Map files now support an optional `$config` key to declare provider and connection
|
|
6
|
+
details inline (e.g., `"provider": "azure"`, `"vaultUrl": "https://..."`, `"profile": "dev-account"`)
|
|
7
|
+
* New CLI flag `--vault-url <url>` — Azure Key Vault URL, overrides `$config.vaultUrl` in the map file
|
|
8
|
+
* New GitHub Action input `vault-url` — Azure Key Vault URL, overrides `$config.vaultUrl` in the map file
|
|
9
|
+
* Precedence chain: CLI flags / GHA inputs > `$config` in map file > defaults
|
|
10
|
+
* Backward compatible: existing map files without `$config` continue to work (defaults to AWS provider)
|
|
11
|
+
* **Azure Key Vault support** — Use `--provider=azure` (CLI) or `provider: azure` (GitHub Action) to pull/push secrets
|
|
12
|
+
from Azure Key Vault ([#90](https://github.com/macalbert/envilder/pull/90))
|
|
13
|
+
* New infrastructure adapter: `AzureKeyVaultSecretProvider` implementing `ISecretProvider`
|
|
14
|
+
* New CLI option `--provider <name>` to select cloud provider (`aws` or `azure`, default: `aws`)
|
|
15
|
+
* New GitHub Action input `provider` for selecting the cloud provider
|
|
16
|
+
* Azure authentication via `DefaultAzureCredential` (supports Azure CLI, managed identity, etc.)
|
|
17
|
+
* Automatic secret name normalization for Azure Key Vault naming constraints
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
* **CLI flag `--ssm-path` renamed to `--secret-path`** — The old flag is still accepted as a deprecated alias and
|
|
22
|
+
prints a warning. It will be removed in a future release.
|
|
23
|
+
* `configureInfrastructureServices()` now receives a single `MapFileConfig` object instead of separate parameters
|
|
24
|
+
* CLI and GHA entry points read `$config` from the map file and merge with CLI flags / GHA inputs
|
|
25
|
+
* Extracted shared `ContainerConfiguration` module (`src/apps/shared/`) for DI setup reused by CLI and GitHub Action
|
|
26
|
+
* Both `Startup.ts` files (CLI and GHA) now delegate to shared `configureInfrastructureServices()` and `configureApplicationServices()`
|
|
27
|
+
* Updated CLI description to include Azure Key Vault examples
|
|
28
|
+
* Updated `action.yml` description and inputs to reflect multi-provider support
|
|
29
|
+
|
|
30
|
+
### Dependencies
|
|
31
|
+
|
|
32
|
+
* Added `@azure/keyvault-secrets`
|
|
33
|
+
* Added `@azure/identity`
|
|
34
|
+
* Added `@azure/core-rest-pipeline`
|
|
35
|
+
|
|
36
|
+
### Documentation
|
|
37
|
+
|
|
38
|
+
* Updated all documentation to reflect `$config` map-file section and `--vault-url` flag
|
|
39
|
+
* Updated architecture diagrams and DI code snippets
|
|
40
|
+
* Updated GitHub Action examples to use `vault-url` input
|
|
41
|
+
* Updated ROADMAP to mark Azure Key Vault as fully implemented
|
|
42
|
+
|
|
43
|
+
---
|
|
3
44
|
|
|
4
45
|
## [0.7.6] - 2026-01-16
|
|
5
46
|
|
|
@@ -119,13 +160,6 @@
|
|
|
119
160
|
|
|
120
161
|
---
|
|
121
162
|
|
|
122
|
-
## Changelog
|
|
123
|
-
|
|
124
|
-
All notable changes to this project will be documented in this file.
|
|
125
|
-
|
|
126
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
127
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
128
|
-
|
|
129
163
|
## [0.6.6] - 2025-11-02
|
|
130
164
|
|
|
131
165
|
### Changed
|
|
@@ -349,95 +383,3 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
349
383
|
## [0.1.4] - 2024-10-01
|
|
350
384
|
|
|
351
385
|
Initial public release of Envilder.
|
|
352
|
-
|
|
353
|
-
---
|
|
354
|
-
|
|
355
|
-
## How to Update This Changelog
|
|
356
|
-
|
|
357
|
-
This changelog follows [Conventional Commits](https://www.conventionalcommits.org/) specification.
|
|
358
|
-
|
|
359
|
-
### Commit Message Format
|
|
360
|
-
|
|
361
|
-
```txt
|
|
362
|
-
<type>[optional scope]: <description>
|
|
363
|
-
|
|
364
|
-
[optional body]
|
|
365
|
-
|
|
366
|
-
[optional footer(s)]
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
### Types
|
|
370
|
-
|
|
371
|
-
* `feat`: A new feature (triggers MINOR version bump)
|
|
372
|
-
* `fix`: A bug fix (triggers PATCH version bump)
|
|
373
|
-
* `docs`: Documentation-only changes
|
|
374
|
-
* `style`: Changes that don't affect code meaning (formatting, etc.)
|
|
375
|
-
* `refactor`: Code change that neither fixes a bug nor adds a feature
|
|
376
|
-
* `perf`: Performance improvements
|
|
377
|
-
* `test`: Adding or correcting tests
|
|
378
|
-
* `chore`: Changes to build process or auxiliary tools
|
|
379
|
-
* `ci`: Changes to CI configuration files and scripts
|
|
380
|
-
|
|
381
|
-
### Breaking Changes
|
|
382
|
-
|
|
383
|
-
Add `BREAKING CHANGE:` in the footer or append `!` after type/scope:
|
|
384
|
-
|
|
385
|
-
```txt
|
|
386
|
-
feat!: remove AWS profile auto-detection
|
|
387
|
-
|
|
388
|
-
BREAKING CHANGE: Users must now explicitly specify --profile flag
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
This triggers a MAJOR version bump.
|
|
392
|
-
|
|
393
|
-
### Examples
|
|
394
|
-
|
|
395
|
-
```bash
|
|
396
|
-
# Feature addition (0.7.0 -> 0.8.0)
|
|
397
|
-
git commit -m "feat(gha): add GitHub Action support"
|
|
398
|
-
|
|
399
|
-
# Bug fix (0.7.0 -> 0.7.1)
|
|
400
|
-
git commit -m "fix(cli): handle empty environment files"
|
|
401
|
-
|
|
402
|
-
# Breaking change (0.7.0 -> 1.0.0)
|
|
403
|
-
git commit -m "feat!: redesign CLI interface"
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
---
|
|
407
|
-
|
|
408
|
-
## Maintenance
|
|
409
|
-
|
|
410
|
-
This project follows [Conventional Commits](https://www.conventionalcommits.org/) for commit messages.
|
|
411
|
-
|
|
412
|
-
**To update this changelog**:
|
|
413
|
-
|
|
414
|
-
1. Edit this file following the format above
|
|
415
|
-
2. Add entries under `[Unreleased]` section
|
|
416
|
-
3. Run `pnpm version [patch|minor|major]` to create a new release
|
|
417
|
-
4. Move `[Unreleased]` entries to the new version section
|
|
418
|
-
|
|
419
|
-
**Alternative**: Use [GitHub Releases](https://github.com/macalbert/envilder/releases) to auto-generate release notes
|
|
420
|
-
from commit messages.
|
|
421
|
-
|
|
422
|
-
[0.7.6]: https://github.com/macalbert/envilder/compare/v0.7.5...v0.7.6
|
|
423
|
-
[0.7.5]: https://github.com/macalbert/envilder/compare/v0.7.4...v0.7.5
|
|
424
|
-
[0.7.4]: https://github.com/macalbert/envilder/compare/v0.7.3...v0.7.4
|
|
425
|
-
[0.7.3]: https://github.com/macalbert/envilder/compare/v0.7.2...v0.7.3
|
|
426
|
-
[0.7.2]: https://github.com/macalbert/envilder/compare/v0.7.1...v0.7.2
|
|
427
|
-
[0.7.1]: https://github.com/macalbert/envilder/compare/v0.6.6...v0.7.1
|
|
428
|
-
[0.6.6]: https://github.com/macalbert/envilder/compare/v0.6.5...v0.6.6
|
|
429
|
-
[0.6.5]: https://github.com/macalbert/envilder/compare/v0.6.4...v0.6.5
|
|
430
|
-
[0.6.4]: https://github.com/macalbert/envilder/compare/v0.6.3...v0.6.4
|
|
431
|
-
[0.6.3]: https://github.com/macalbert/envilder/compare/v0.6.1...v0.6.3
|
|
432
|
-
[0.6.1]: https://github.com/macalbert/envilder/compare/v0.5.6...v0.6.1
|
|
433
|
-
[0.5.6]: https://github.com/macalbert/envilder/compare/v0.5.5...v0.5.6
|
|
434
|
-
[0.5.5]: https://github.com/macalbert/envilder/compare/v0.5.4...v0.5.5
|
|
435
|
-
[0.5.4]: https://github.com/macalbert/envilder/compare/v0.5.3...v0.5.4
|
|
436
|
-
[0.5.3]: https://github.com/macalbert/envilder/compare/v0.5.2...v0.5.3
|
|
437
|
-
[0.5.2]: https://github.com/macalbert/envilder/compare/v0.5.1...v0.5.2
|
|
438
|
-
[0.5.1]: https://github.com/macalbert/envilder/compare/v0.3.0...v0.5.1
|
|
439
|
-
[0.3.0]: https://github.com/macalbert/envilder/compare/v0.2.3...v0.3.0
|
|
440
|
-
[0.2.3]: https://github.com/macalbert/envilder/compare/v0.2.1...v0.2.3
|
|
441
|
-
[0.2.1]: https://github.com/macalbert/envilder/compare/v0.1.4...v0.2.1
|
|
442
|
-
[0.1.4]: https://github.com/macalbert/envilder/releases/tag/v0.1.4
|
|
443
|
-
<!-- markdownlint-enable MD024 -->
|
package/docs/SECURITY.md
CHANGED
|
@@ -54,9 +54,25 @@ When using Envilder, follow these security guidelines:
|
|
|
54
54
|
- ❌ Store AWS access keys in code or environment variables
|
|
55
55
|
- ❌ Share AWS credentials via Slack, email, or chat
|
|
56
56
|
|
|
57
|
+
### Azure Credentials
|
|
58
|
+
|
|
59
|
+
**DO**:
|
|
60
|
+
|
|
61
|
+
- ✅ Use workload identity federation (OIDC) for GitHub Actions ([setup guide](https://learn.microsoft.com/en-us/entra/workload-id/workload-identity-federation-create-trust-github))
|
|
62
|
+
- ✅ Use managed identities in Azure-hosted environments
|
|
63
|
+
- ✅ Scope Key Vault access to specific secrets and operations
|
|
64
|
+
- ✅ Set vault URL via `$config.vaultUrl` in your map file or `--vault-url` flag—never hardcode secrets in code
|
|
65
|
+
|
|
66
|
+
**DON'T**:
|
|
67
|
+
|
|
68
|
+
- ❌ Store Azure client secrets in code
|
|
69
|
+
- ❌ Use overly broad Key Vault access policies
|
|
70
|
+
|
|
57
71
|
### IAM Permissions
|
|
58
72
|
|
|
59
|
-
Envilder requires these
|
|
73
|
+
Envilder requires these cloud provider permissions:
|
|
74
|
+
|
|
75
|
+
#### AWS
|
|
60
76
|
|
|
61
77
|
```json
|
|
62
78
|
{
|
|
@@ -107,7 +123,7 @@ When using Envilder GitHub Action:
|
|
|
107
123
|
**DO**:
|
|
108
124
|
|
|
109
125
|
- ✅ Use OIDC authentication instead of static credentials ([OIDC setup guide](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services))
|
|
110
|
-
- ✅ Pin action versions (e.g., `@
|
|
126
|
+
- ✅ Pin action versions (e.g., `@v0.8.0` instead of `@main`)
|
|
111
127
|
- ✅ Review action code before using in production
|
|
112
128
|
|
|
113
129
|
**DON'T**:
|
|
@@ -135,6 +151,14 @@ View current security status: [ || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
10
21
|
import 'reflect-metadata';
|
|
11
22
|
import { dirname, join } from 'node:path';
|
|
12
23
|
import { fileURLToPath } from 'node:url';
|
|
13
24
|
import { Command } from 'commander';
|
|
25
|
+
import pc from 'picocolors';
|
|
14
26
|
import { DispatchActionCommand } from '../../envilder/application/dispatch/DispatchActionCommand.js';
|
|
15
27
|
import { PackageVersionReader } from '../../envilder/infrastructure/package/PackageVersionReader.js';
|
|
28
|
+
import { readMapFileConfig } from '../../envilder/infrastructure/variableStore/FileVariableStore.js';
|
|
16
29
|
import { TYPES } from '../../envilder/types.js';
|
|
17
30
|
import { Startup } from './Startup.js';
|
|
18
31
|
let serviceProvider;
|
|
@@ -27,27 +40,71 @@ export function main() {
|
|
|
27
40
|
return __awaiter(this, void 0, void 0, function* () {
|
|
28
41
|
const program = new Command();
|
|
29
42
|
const version = yield readPackageVersion();
|
|
43
|
+
const banner = `
|
|
44
|
+
${pc.green('███████╗')}${pc.cyan('███╗ ██╗')}${pc.magenta('██╗ ██╗')}${pc.yellow('██╗')}${pc.red('██╗ ')}${pc.blue('██████╗ ')}${pc.green('███████╗')}${pc.cyan('██████╗ ')}
|
|
45
|
+
${pc.green('██╔════╝')}${pc.cyan('████╗ ██║')}${pc.magenta('██║ ██║')}${pc.yellow('██║')}${pc.red('██║ ')}${pc.blue('██╔══██╗')}${pc.green('██╔════╝')}${pc.cyan('██╔══██╗')}
|
|
46
|
+
${pc.green('█████╗ ')}${pc.cyan('██╔██╗ ██║')}${pc.magenta('██║ ██║')}${pc.yellow('██║')}${pc.red('██║ ')}${pc.blue('██║ ██║')}${pc.green('█████╗ ')}${pc.cyan('██████╔╝')}
|
|
47
|
+
${pc.green('██╔══╝ ')}${pc.cyan('██║╚██╗██║')}${pc.magenta('╚██╗ ██╔╝')}${pc.yellow('██║')}${pc.red('██║ ')}${pc.blue('██║ ██║')}${pc.green('██╔══╝ ')}${pc.cyan('██╔══██╗')}
|
|
48
|
+
${pc.green('███████╗')}${pc.cyan('██║ ╚████║')}${pc.magenta(' ╚████╔╝ ')}${pc.yellow('██║')}${pc.red('███████╗')}${pc.blue('██████╔╝')}${pc.green('███████╗')}${pc.cyan('██║ ██║')}
|
|
49
|
+
${pc.green('╚══════╝')}${pc.cyan('╚═╝ ╚═══╝')}${pc.magenta(' ╚═══╝ ')}${pc.yellow('╚═╝')}${pc.red('╚══════╝')}${pc.blue('╚═════╝ ')}${pc.green('╚══════╝')}${pc.cyan('╚═╝ ╚═╝')}
|
|
50
|
+
${pc.dim('Your secrets, one command away')} ${pc.dim('aws & azure')}
|
|
51
|
+
|
|
52
|
+
${pc.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
|
|
53
|
+
${pc.green('WORLD 1-1')} ${pc.dim('— SELECT YOUR MISSION')}
|
|
54
|
+
${pc.yellow('━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━')}
|
|
55
|
+
|
|
56
|
+
${pc.green('>')} ${pc.bold('Generate a .env file')} ${pc.dim('(pull secrets from the cloud)')}
|
|
57
|
+
${pc.cyan('envilder --map=param-map.json --envfile=.env')}
|
|
58
|
+
|
|
59
|
+
${pc.magenta('>')} ${pc.bold('Sync .env back to cloud')} ${pc.dim('(push secrets up)')}
|
|
60
|
+
${pc.cyan('envilder --push --map=param-map.json --envfile=.env')}
|
|
61
|
+
|
|
62
|
+
${pc.red('>')} ${pc.bold('Push a single secret')}
|
|
63
|
+
${pc.cyan('envilder --push --key=API_KEY --value=s3cret --secret-path=/my/path')}
|
|
64
|
+
|
|
65
|
+
${pc.blue('>')} ${pc.bold('Use Azure Key Vault')}
|
|
66
|
+
${pc.cyan('envilder --provider=azure --map=param-map.json --envfile=.env')}
|
|
67
|
+
`;
|
|
30
68
|
program
|
|
31
69
|
.name('envilder')
|
|
32
|
-
.description(
|
|
33
|
-
'✨ Generate a .env file?\n' +
|
|
34
|
-
' Example: envilder --map=param-map.json --envfile=.env\n\n' +
|
|
35
|
-
'🔄 Sync your local .env file back to AWS SSM?\n' +
|
|
36
|
-
' Example: envilder --push --map=param-map.json --envfile=.env\n\n' +
|
|
37
|
-
'🎯 Create or update a single secret?\n' +
|
|
38
|
-
' Example: envilder --push --key=API_KEY --value=secret123 --ssm-path=/my/path\n')
|
|
70
|
+
.description(banner)
|
|
39
71
|
.version(version)
|
|
40
72
|
.option('--map <path>', 'Path to the JSON file with environment variable mapping (required for most commands)')
|
|
41
73
|
.option('--envfile <path>', 'Path to the .env file to be generated or imported (required for most commands)')
|
|
42
74
|
.option('--profile <name>', 'AWS CLI profile to use (optional)')
|
|
43
|
-
.option('--
|
|
75
|
+
.option('--provider <name>', 'Cloud provider to use: aws or azure (default: aws)')
|
|
76
|
+
.option('--vault-url <url>', 'Azure Key Vault URL (overrides $config.vaultUrl in map file)')
|
|
77
|
+
.option('--push', 'Push local .env file back to cloud provider')
|
|
44
78
|
.option('--key <name>', 'Single environment variable name to push (only with --push)')
|
|
45
79
|
.option('--value <value>', 'Value of the single environment variable to push (only with --push)')
|
|
46
|
-
.option('--
|
|
47
|
-
.
|
|
80
|
+
.option('--secret-path <path>', 'Secret path in your cloud provider for the single variable (only with --push)')
|
|
81
|
+
.option('--ssm-path <path>', '[DEPRECATED: use --secret-path] Alias for --secret-path')
|
|
82
|
+
.hook('preAction', (thisCommand) => {
|
|
83
|
+
const opts = thisCommand.opts();
|
|
84
|
+
if (opts.ssmPath) {
|
|
85
|
+
console.warn(pc.yellow('⚠️ --ssm-path is deprecated and will be removed in a future release. Use --secret-path instead.'));
|
|
86
|
+
if (!opts.secretPath) {
|
|
87
|
+
thisCommand.setOptionValue('secretPath', opts.ssmPath);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
})
|
|
91
|
+
.action((_a) => __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
var { provider, vaultUrl } = _a, options = __rest(_a, ["provider", "vaultUrl"]);
|
|
93
|
+
const fileConfig = options.map
|
|
94
|
+
? yield readMapFileConfig(options.map)
|
|
95
|
+
: {};
|
|
96
|
+
const config = Object.assign(Object.assign(Object.assign(Object.assign({}, fileConfig), (provider && { provider })), (vaultUrl && { vaultUrl })), (options.profile && { profile: options.profile }));
|
|
97
|
+
const infraOptions = {};
|
|
98
|
+
const extraHosts = process.env.ENVILDER_ALLOWED_VAULT_HOSTS;
|
|
99
|
+
if (extraHosts) {
|
|
100
|
+
infraOptions.allowedVaultHosts = extraHosts
|
|
101
|
+
.split(',')
|
|
102
|
+
.map((h) => h.trim());
|
|
103
|
+
infraOptions.disableChallengeResourceVerification = true;
|
|
104
|
+
}
|
|
48
105
|
serviceProvider = Startup.build()
|
|
49
106
|
.configureServices()
|
|
50
|
-
.configureInfrastructure(
|
|
107
|
+
.configureInfrastructure(config, infraOptions)
|
|
51
108
|
.create();
|
|
52
109
|
yield executeCommand(options);
|
|
53
110
|
}));
|
package/lib/apps/cli/Cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../../src/apps/cli/Cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Cli.js","sourceRoot":"","sources":["../../../src/apps/cli/Cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC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inversify';
|
|
2
|
+
import type { MapFileConfig } from '../../envilder/domain/MapFileConfig.js';
|
|
3
|
+
import { type InfrastructureOptions } from '../shared/ContainerConfiguration.js';
|
|
2
4
|
export declare class Startup {
|
|
3
5
|
private readonly container;
|
|
4
6
|
constructor();
|
|
5
7
|
static build(): Startup;
|
|
6
8
|
configureServices(): this;
|
|
7
|
-
|
|
8
|
-
* Configures infrastructure services for the application.
|
|
9
|
-
* Optionally accepts an AWS profile to use for service configuration.
|
|
10
|
-
* @param awsProfile - The AWS profile to use for configuring infrastructure services.
|
|
11
|
-
* @returns The current instance for method chaining.
|
|
12
|
-
*/
|
|
13
|
-
configureInfrastructure(awsProfile?: string): this;
|
|
9
|
+
configureInfrastructure(config?: MapFileConfig, options?: InfrastructureOptions): this;
|
|
14
10
|
create(): Container;
|
|
15
11
|
getServiceProvider(): Container;
|
|
16
|
-
private configureInfrastructureServices;
|
|
17
|
-
private configureApplicationServices;
|
|
18
12
|
}
|
|
19
13
|
//# sourceMappingURL=Startup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Startup.d.ts","sourceRoot":"","sources":["../../../src/apps/cli/Startup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Startup.d.ts","sourceRoot":"","sources":["../../../src/apps/cli/Startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,qCAAqC,CAAC;AAE7C,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;;IAMtC,MAAM,CAAC,KAAK,IAAI,OAAO;IAIvB,iBAAiB,IAAI,IAAI;IAKzB,uBAAuB,CACrB,MAAM,CAAC,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI;IAKP,MAAM,IAAI,SAAS;IAInB,kBAAkB,IAAI,SAAS;CAGhC"}
|
package/lib/apps/cli/Startup.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
import { SSM } from '@aws-sdk/client-ssm';
|
|
2
|
-
import { fromIni } from '@aws-sdk/credential-providers';
|
|
3
1
|
import { Container } from 'inversify';
|
|
4
|
-
import {
|
|
5
|
-
import { PullSsmToEnvCommandHandler } from '../../envilder/application/pullSsmToEnv/PullSsmToEnvCommandHandler.js';
|
|
6
|
-
import { PushEnvToSsmCommandHandler } from '../../envilder/application/pushEnvToSsm/PushEnvToSsmCommandHandler.js';
|
|
7
|
-
import { PushSingleCommandHandler } from '../../envilder/application/pushSingle/PushSingleCommandHandler.js';
|
|
8
|
-
import { AwsSsmSecretProvider } from '../../envilder/infrastructure/aws/AwsSsmSecretProvider.js';
|
|
9
|
-
import { ConsoleLogger } from '../../envilder/infrastructure/logger/ConsoleLogger.js';
|
|
10
|
-
import { FileVariableStore } from '../../envilder/infrastructure/variableStore/FileVariableStore.js';
|
|
11
|
-
import { TYPES } from '../../envilder/types.js';
|
|
2
|
+
import { configureApplicationServices, configureInfrastructureServices, } from '../shared/ContainerConfiguration.js';
|
|
12
3
|
export class Startup {
|
|
13
4
|
constructor() {
|
|
14
5
|
this.container = new Container();
|
|
@@ -17,17 +8,11 @@ export class Startup {
|
|
|
17
8
|
return new Startup();
|
|
18
9
|
}
|
|
19
10
|
configureServices() {
|
|
20
|
-
this.
|
|
11
|
+
configureApplicationServices(this.container);
|
|
21
12
|
return this;
|
|
22
13
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
* Optionally accepts an AWS profile to use for service configuration.
|
|
26
|
-
* @param awsProfile - The AWS profile to use for configuring infrastructure services.
|
|
27
|
-
* @returns The current instance for method chaining.
|
|
28
|
-
*/
|
|
29
|
-
configureInfrastructure(awsProfile) {
|
|
30
|
-
this.configureInfrastructureServices(awsProfile);
|
|
14
|
+
configureInfrastructure(config, options) {
|
|
15
|
+
configureInfrastructureServices(this.container, config, options);
|
|
31
16
|
return this;
|
|
32
17
|
}
|
|
33
18
|
create() {
|
|
@@ -36,40 +21,5 @@ export class Startup {
|
|
|
36
21
|
getServiceProvider() {
|
|
37
22
|
return this.container;
|
|
38
23
|
}
|
|
39
|
-
configureInfrastructureServices(awsProfile) {
|
|
40
|
-
this.container
|
|
41
|
-
.bind(TYPES.ILogger)
|
|
42
|
-
.to(ConsoleLogger)
|
|
43
|
-
.inSingletonScope();
|
|
44
|
-
this.container
|
|
45
|
-
.bind(TYPES.IVariableStore)
|
|
46
|
-
.to(FileVariableStore)
|
|
47
|
-
.inSingletonScope();
|
|
48
|
-
const ssm = awsProfile
|
|
49
|
-
? new SSM({ credentials: fromIni({ profile: awsProfile }) })
|
|
50
|
-
: new SSM();
|
|
51
|
-
const secretProvider = new AwsSsmSecretProvider(ssm);
|
|
52
|
-
this.container
|
|
53
|
-
.bind(TYPES.ISecretProvider)
|
|
54
|
-
.toConstantValue(secretProvider);
|
|
55
|
-
}
|
|
56
|
-
configureApplicationServices() {
|
|
57
|
-
this.container
|
|
58
|
-
.bind(TYPES.PullSsmToEnvCommandHandler)
|
|
59
|
-
.to(PullSsmToEnvCommandHandler)
|
|
60
|
-
.inTransientScope();
|
|
61
|
-
this.container
|
|
62
|
-
.bind(TYPES.PushEnvToSsmCommandHandler)
|
|
63
|
-
.to(PushEnvToSsmCommandHandler)
|
|
64
|
-
.inTransientScope();
|
|
65
|
-
this.container
|
|
66
|
-
.bind(TYPES.PushSingleCommandHandler)
|
|
67
|
-
.to(PushSingleCommandHandler)
|
|
68
|
-
.inTransientScope();
|
|
69
|
-
this.container
|
|
70
|
-
.bind(TYPES.DispatchActionCommandHandler)
|
|
71
|
-
.to(DispatchActionCommandHandler)
|
|
72
|
-
.inTransientScope();
|
|
73
|
-
}
|
|
74
24
|
}
|
|
75
25
|
//# sourceMappingURL=Startup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Startup.js","sourceRoot":"","sources":["../../../src/apps/cli/Startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Startup.js","sourceRoot":"","sources":["../../../src/apps/cli/Startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EACL,4BAA4B,EAC5B,+BAA+B,GAEhC,MAAM,qCAAqC,CAAC;AAE7C,MAAM,OAAO,OAAO;IAGlB;QACE,IAAI,CAAC,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,OAAO,EAAE,CAAC;IACvB,CAAC;IAED,iBAAiB;QACf,4BAA4B,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,uBAAuB,CACrB,MAAsB,EACtB,OAA+B;QAE/B,+BAA+B,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACjE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gha.d.ts","sourceRoot":"","sources":["../../../src/apps/gha/Gha.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"Gha.d.ts","sourceRoot":"","sources":["../../../src/apps/gha/Gha.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAkD1B,wBAAsB,IAAI,kBA6CzB"}
|
package/lib/apps/gha/Gha.js
CHANGED
|
@@ -9,9 +9,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import 'reflect-metadata';
|
|
11
11
|
import { DispatchActionCommand } from '../../envilder/application/dispatch/DispatchActionCommand.js';
|
|
12
|
+
import { ConsoleLogger } from '../../envilder/infrastructure/logger/ConsoleLogger.js';
|
|
13
|
+
import { readMapFileConfig } from '../../envilder/infrastructure/variableStore/FileVariableStore.js';
|
|
12
14
|
import { TYPES } from '../../envilder/types.js';
|
|
13
15
|
import { Startup } from './Startup.js';
|
|
14
|
-
let serviceProvider;
|
|
15
16
|
/**
|
|
16
17
|
* Reads GitHub Actions inputs from environment variables.
|
|
17
18
|
* GitHub Actions passes inputs as INPUT_<NAME> environment variables.
|
|
@@ -19,14 +20,20 @@ let serviceProvider;
|
|
|
19
20
|
function readInputs() {
|
|
20
21
|
const mapFile = process.env.INPUT_MAP_FILE;
|
|
21
22
|
const envFile = process.env.INPUT_ENV_FILE;
|
|
23
|
+
const provider = process.env.INPUT_PROVIDER;
|
|
24
|
+
const vaultUrl = process.env.INPUT_VAULT_URL;
|
|
22
25
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
options: {
|
|
27
|
+
map: mapFile,
|
|
28
|
+
envfile: envFile,
|
|
29
|
+
// GitHub Action only supports pull mode
|
|
30
|
+
push: false,
|
|
31
|
+
},
|
|
32
|
+
provider: provider || undefined,
|
|
33
|
+
vaultUrl: vaultUrl || undefined,
|
|
27
34
|
};
|
|
28
35
|
}
|
|
29
|
-
function executeCommand(options) {
|
|
36
|
+
function executeCommand(serviceProvider, options) {
|
|
30
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
31
38
|
const commandHandler = serviceProvider.get(TYPES.DispatchActionCommandHandler);
|
|
32
39
|
const command = DispatchActionCommand.fromCliOptions(options);
|
|
@@ -35,28 +42,38 @@ function executeCommand(options) {
|
|
|
35
42
|
}
|
|
36
43
|
export function main() {
|
|
37
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
-
const
|
|
45
|
+
const { options, provider, vaultUrl } = readInputs();
|
|
46
|
+
let serviceProvider;
|
|
47
|
+
let logger = new ConsoleLogger();
|
|
48
|
+
try {
|
|
49
|
+
const fileConfig = options.map ? yield readMapFileConfig(options.map) : {};
|
|
50
|
+
const config = Object.assign(Object.assign(Object.assign({}, fileConfig), (provider && { provider })), (vaultUrl && { vaultUrl }));
|
|
51
|
+
const startup = Startup.build();
|
|
52
|
+
startup.configureServices().configureInfrastructure(config);
|
|
53
|
+
serviceProvider = startup.create();
|
|
54
|
+
logger = serviceProvider.get(TYPES.ILogger);
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
58
|
+
logger.error(`🚨 Failed to initialize: ${message}`);
|
|
59
|
+
throw error;
|
|
60
|
+
}
|
|
39
61
|
try {
|
|
40
|
-
const options = readInputs();
|
|
41
62
|
// Validate required inputs
|
|
42
63
|
if (!options.map || !options.envfile) {
|
|
43
64
|
throw new Error('🚨 Missing required inputs! Please provide map-file and env-file.');
|
|
44
65
|
}
|
|
45
|
-
logger
|
|
46
|
-
logger
|
|
47
|
-
logger
|
|
48
|
-
yield executeCommand(options);
|
|
49
|
-
logger
|
|
66
|
+
logger.info('🔑 Envilder GitHub Action - Starting secret pull...');
|
|
67
|
+
logger.info(`📋 Map file: ${options.map}`);
|
|
68
|
+
logger.info(`📄 Env file: ${options.envfile}`);
|
|
69
|
+
yield executeCommand(serviceProvider, options);
|
|
70
|
+
logger.info('✅ Secrets pulled successfully!');
|
|
50
71
|
}
|
|
51
72
|
catch (error) {
|
|
52
|
-
logger
|
|
53
|
-
logger
|
|
73
|
+
logger.error('🚨 Uh-oh! Looks like Mario fell into the wrong pipe! 🍄💥');
|
|
74
|
+
logger.error(error instanceof Error ? error.message : String(error));
|
|
54
75
|
throw error;
|
|
55
76
|
}
|
|
56
77
|
});
|
|
57
78
|
}
|
|
58
|
-
// Initialize the service provider
|
|
59
|
-
const startup = Startup.build();
|
|
60
|
-
startup.configureServices().configureInfrastructure();
|
|
61
|
-
serviceProvider = startup.create();
|
|
62
79
|
//# sourceMappingURL=Gha.js.map
|
package/lib/apps/gha/Gha.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Gha.js","sourceRoot":"","sources":["../../../src/apps/gha/Gha.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;
|
|
1
|
+
{"version":3,"file":"Gha.js","sourceRoot":"","sources":["../../../src/apps/gha/Gha.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAE1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,8DAA8D,CAAC;AAKrG,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AACrG,OAAO,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;;GAGG;AACH,SAAS,UAAU;IAKjB,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC3C,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC3C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAC5C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IAE7C,OAAO;QACL,OAAO,EAAE;YACP,GAAG,EAAE,OAAO;YACZ,OAAO,EAAE,OAAO;YAChB,wCAAwC;YACxC,IAAI,EAAE,KAAK;SACZ;QACD,QAAQ,EAAE,QAAQ,IAAI,SAAS;QAC/B,QAAQ,EAAE,QAAQ,IAAI,SAAS;KAChC,CAAC;AACJ,CAAC;AAED,SAAe,cAAc,CAC3B,eAA0B,EAC1B,OAAmB;;QAEnB,MAAM,cA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C3B,IAAI,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;gBACrC,MAAM,IAAI,KAAK,CACb,mEAAmE,CACpE,CAAC;YACJ,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;YACnE,MAAM,CAAC,IAAI,CAAC,gBAAgB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YAC3C,MAAM,CAAC,IAAI,CAAC,gBAAgB,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;YAE/C,MAAM,cAAc,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;YAE/C,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAChD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;YAC1E,MAAM,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACrE,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
import { Container } from 'inversify';
|
|
2
|
+
import type { MapFileConfig } from '../../envilder/domain/MapFileConfig.js';
|
|
3
|
+
import { type InfrastructureOptions } from '../shared/ContainerConfiguration.js';
|
|
2
4
|
export declare class Startup {
|
|
3
5
|
private readonly container;
|
|
4
6
|
constructor();
|
|
5
7
|
static build(): Startup;
|
|
6
8
|
configureServices(): this;
|
|
7
|
-
|
|
8
|
-
* Configures infrastructure services for the application.
|
|
9
|
-
* Optionally accepts an AWS profile to use for service configuration.
|
|
10
|
-
* @param awsProfile - The AWS profile to use for configuring infrastructure services.
|
|
11
|
-
* @returns The current instance for method chaining.
|
|
12
|
-
*/
|
|
13
|
-
configureInfrastructure(awsProfile?: string): this;
|
|
9
|
+
configureInfrastructure(config?: MapFileConfig, options?: InfrastructureOptions): this;
|
|
14
10
|
create(): Container;
|
|
15
11
|
getServiceProvider(): Container;
|
|
16
|
-
private configureInfrastructureServices;
|
|
17
|
-
private configureApplicationServices;
|
|
18
12
|
}
|
|
19
13
|
//# sourceMappingURL=Startup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Startup.d.ts","sourceRoot":"","sources":["../../../src/apps/gha/Startup.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Startup.d.ts","sourceRoot":"","sources":["../../../src/apps/gha/Startup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,qCAAqC,CAAC;AAE7C,qBAAa,OAAO;IAClB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;;IAMtC,MAAM,CAAC,KAAK,IAAI,OAAO;IAIvB,iBAAiB,IAAI,IAAI;IAKzB,uBAAuB,CACrB,MAAM,CAAC,EAAE,aAAa,EACtB,OAAO,CAAC,EAAE,qBAAqB,GAC9B,IAAI;IAKP,MAAM,IAAI,SAAS;IAInB,kBAAkB,IAAI,SAAS;CAGhC"}
|