Skip to content

Centralize BoolString parsing. #124

Open

Description

@adeutscher

Many points in the application, especially those based on patterns established in the early days. However, some sporadic commits interpret nullable strings that allow the variable to be set as a bool-parseable value or a greater-than-0 int.

It's not the end of the world, but:

  • It is inconsistent when some boolean properties support flexible phrasing and some don't.
  • While the logic is far from complex, it's lengthy enough to be annoying.

My current plan is:

  • Place a string extension in Common. Tentative signature: bool InterpretAsBoolProperty(this string input).
  • All boolean configuration values should be updated to be consistent. Actions per property:
    • Adjust bool property to string? properties.
    • Have an Effective_ supporting property that interprets the string.

Activity

  1. self-assigned this
    on Sep 4, 2026
  2. adeutscher commented on Sep 5, 2026

    @adeutscher
    OwnerAuthor

    Did an automated sweep for bool properties to consider (this sweep also captured properties that were already string-parsed):

    Configuration model File Config section Boolean property Typical environment variable
    CoreConfigurationModel src/RedShirt.Example.JobWorker.Core/Configuration/CoreConfigurationModel.cs Jobs HaltOnFailure JOBS__HALT_ON_FAILURE
    CoreConfigurationModel same Jobs TreatTransientExceptionAsFailure JOBS__TREAT_TRANSIENT_EXCEPTION_AS_FAILURE
    IdempotencyConfigurationModel src/RedShirt.Example.JobWorker.Core/Configuration/IdempotencyConfigurationModel.cs Jobs:Idempotency Enabled JOBS__IDEMPOTENCY__ENABLED
    IdempotencyConfigurationModel same Jobs:Idempotency IdempotencyIdsCanRepeat JOBS__IDEMPOTENCY__IDEMPOTENCY_IDS_CAN_REPEAT
    IdempotencyConfigurationModel same Jobs:Idempotency EnableTraceLogging JOBS__IDEMPOTENCY__ENABLE_TRACE_LOGGING
    LoaderModeConfigurationModel src/RedShirt.Example.JobWorker.Core/Configuration/LoaderModeConfigurationModel.cs Jobs:LoaderMode Enabled (string) → EffectiveEnabledSetting JOBS__LOADER_MODE__ENABLED
    CommonHealthConfigurationModel src/RedShirt.Example.JobWorker.Common.Health/Configuration/CommonHealthConfigurationModel.cs Health Enabled (default true) HEALTH__ENABLED
    CoreHealthStateService.ConfigurationModel src/RedShirt.Example.JobWorker.Core/Services/Health/CoreHealthStateService.cs Health Enabled (default true) HEALTH__ENABLED
    JobLogicRunner.ConfigurationModel src/RedShirt.Example.JobWorker.Core.Logic/JobLogicRunner.cs Jobs:JobLogic AccessBarEnabled (string) → EffectiveAccessBarEnabled JOBS__JOB_LOGIC__ACCESS_BAR_ENABLED
    AzureServiceBusConfigurationModel src/RedShirt.Example.JobWorker.JobManagement.AzureServiceBus/Configuration/AzureServiceBusConfigurationModel.cs JobSource:AzureServiceBus AbandonRecoveredFailuresOnAcknowledge JOB_SOURCE__AZURE_SERVICE_BUS__ABANDON_RECOVERED_FAILURES_ON_ACKNOWLEDGE
    GooglePubSubConfigurationModel src/RedShirt.Example.JobWorker.JobManagement.GooglePubSub/Configuration/GooglePubSubConfigurationModel.cs JobSource:GooglePubSub DlqNotEnabled JOB_SOURCE__GOOGLE_PUB_SUB__DLQ_NOT_ENABLED
    SqsConfigurationModel src/RedShirt.Example.JobWorker.JobManagement.Sqs/Configuration/SqsConfigurationModel.cs JobSource:SQS DlqNotEnabled JOB_SOURCE__SQS__DLQ_NOT_ENABLED
    KinesisConfiguration src/RedShirt.Example.JobWorker.JobManagement.Kinesis/Configuration/KinesisConfiguration.cs JobSource:Kinesis RoundRobinShards JOB_SOURCE__KINESIS__ROUND_ROBIN_SHARDS
    KinesisConfiguration same JobSource:Kinesis ShuffleShards JOB_SOURCE__KINESIS__SHUFFLE_SHARDS
    SubscribeConfigurationModel (private) src/RedShirt.Example.JobWorker.JobManagement.Nats/Extensions/ServiceCollectionExtensions.cs JobSource:NATS Subscribe JOB_SOURCE__NATS__SUBSCRIBE
    SubscribeConfigurationModel (private) src/RedShirt.Example.JobWorker.JobManagement.RabbitMq/Extensions/ServiceCollectionExtensions.cs JobSource:RabbitMq Subscribe JOB_SOURCE__RABBITMQ__SUBSCRIBE
    SubscribeConfigurationModel (private) src/RedShirt.Example.JobWorker.JobManagement.ActiveMq/Extensions/ServiceCollectionExtensions.cs JobSource:ActiveMq Subscribe JOB_SOURCE__ACTIVEMQ__SUBSCRIBE
    AzureKeyVaultClientFactory.ConfigurationModel src/RedShirt.Example.JobWorker.Common.Azure.KeyVaultSecretManager/Factories/AzureKeyVaultClientFactory.cs Common:Secrets:AzureKeyVault GenerateLocalTestingToken COMMON__SECRETS__AZURE_KEY_VAULT__GENERATE_LOCAL_TESTING_TOKEN
  3. adeutscher commented on Sep 5, 2026

    @adeutscher
    OwnerAuthor

    I'd be remiss if I didn't bring up a counterpoint to this whole thing: Introducing a bool string makes configuration phrasing easier, but it is technically introducing more string parsing over a flat bool.

    At the end of the day, the true goal of this issue is just to pick a lane for consistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CleanupImprove code quality

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions