Skip to content

refactor(secret-resolver)!: refactor to use constants for base path and env var prefix#97

Draft
cassiofariasmachado wants to merge 1 commit into
mainfrom
refactor/secret-resolver-module
Draft

refactor(secret-resolver)!: refactor to use constants for base path and env var prefix#97
cassiofariasmachado wants to merge 1 commit into
mainfrom
refactor/secret-resolver-module

Conversation

@cassiofariasmachado
Copy link
Copy Markdown
Member

Description

Reorders read_from_mount_and_fallback_to_env_var parameters so module, instance, and target come first, and makes base_volume_mount/base_var_name optional kwargs with constant defaults.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring

How to Test

  1. Run the unit tests: uv run pytest -m "not integration" -q
  2. Verify callers no longer need to pass base_volume_mount or base_var_name:
    from sap_cloud_sdk.core.secret_resolver import read_from_mount_and_fallback_to_env_var
    read_from_mount_and_fallback_to_env_var(module="myservice", instance="default", target=cfg)
  3. Verify overrides still work via keyword arguments:
    read_from_mount_and_fallback_to_env_var(
        "myservice", "default", cfg,
        base_volume_mount="/custom/path",
        base_var_name="MY_PREFIX",
    )

Checklist

  • I have read the Contributing Guidelines
  • I have verified that my changes solve the issue
  • I have added/updated automated tests to cover my changes
  • All tests pass locally
  • I have verified that my code follows the Code Guidelines
  • I have updated documentation (if applicable)
  • I have added type hints for all public APIs
  • My code does not contain sensitive information (credentials, tokens, etc.)
  • I have followed Conventional Commits for commit messages

Breaking Changes

  • read_from_mount_and_fallback_to_env_var parameter reorder: The first two positional parameters changed from (base_volume_mount, base_var_name, module, instance, target) to (module, instance, target, base_volume_mount=..., base_var_name=...). Any caller that used positional arguments must be updated.

    Migration: Update call sites to the new positional order, or switch to keyword arguments:

    # Before
    read_from_mount_and_fallback_to_env_var("/etc/secrets/appfnd", "CLOUD_SDK_CFG", "mymod", "inst", cfg)
    
    # After (keyword args — most explicit)
    read_from_mount_and_fallback_to_env_var(module="mymod", instance="inst", target=cfg)
    
    # After (custom path via kwargs)
    read_from_mount_and_fallback_to_env_var("mymod", "inst", cfg, base_volume_mount="/custom", base_var_name="MY_PREFIX")

@cassiofariasmachado cassiofariasmachado changed the title refactor(secret-resolver): refactor to use constants for base path and env var prefix refactor(secret-resolver)!: refactor to use constants for base path and env var prefix May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant