chore(cli): flags to run each mode individually #207
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces significant changes to the application's configuration and mode handling, aiming for better flexibility and clarity.
Key Changes
1. Configuration Loading:
Config
struct now includes aMode
field to represent the application's operational mode.koanf
for merging configurations from struct defaults and environment variables.2. Command-Line Flags and Mode Selection:
migrate
,webhook
,grpc
,queues
.Parse
method has been implemented to parse command-line flags and determine the operational mode.3. Dependency Injection:
Dependencies
method now sets up the application dependencies based on the selected mode.deps
) that allows the app to resolve different dependencies per mode.migrate
,webhook
,nomad
,queues
, andall
mode.4. Mode Constants:
ModeMigrate
,ModeWebhook
,ModeGRPC
,ModeQueues
,ModeDefault
.5. Logger Configuration:
configure_logger
now includes a way to handle debug mode using text handler instead of JSON.6. Main Entry Point Changes:
cfg.Parse()
andcfg.Dependencies()
to configure services.cfg.Mode == ModeMigrate
instead of justcfg.Migrate
.7. Durable Configuration:
8. Queue Configuration:
q_core()
andq_hooks()
are updated to register activities and workflows to the corresponding queues, also including the option to start a session worker.9. Webhook Service:
graceful.Service
which allows for graceful start and stop.Benefits
This refactor provides a more structured approach to managing different aspects of the application based on the execution mode.