Skip to content

Conversation

@yogeshmahajan-1903
Copy link
Contributor

@yogeshmahajan-1903 yogeshmahajan-1903 commented Jan 29, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Improved pgAdmin Docker initialization to better interpret boolean-like configuration values (e.g., "true"/"1"/"false"/"0") for more reliable startup.
    • Ensured configuration keys are written consistently to the container config so user-provided settings are applied as expected.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

Walkthrough

Updated the entrypoint script loop that processes PGADMIN_CONFIG_ environment variables to capture values via eval, lowercase them, map boolean-like strings (true/1True, false/0False), and write the normalized key (without the PGADMIN_CONFIG_ prefix) and value to the config file.

Changes

Cohort / File(s) Summary
Configuration Normalization
pkg/docker/entrypoint.sh
Refactored the PGADMIN_CONFIG_ export loop to use eval to capture raw values into a local variable, lowercase the value, normalize boolean-like strings (true/1True, false/0False), and write the normalized key (stripped PGADMIN_CONFIG_ prefix) and value to the config distribution file.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title contains typos ('Esnure' instead of 'Ensure', 'suuports' instead of 'supports') and is partially related to the changeset, which modifies entrypoint.sh to handle boolean value normalization for YAML configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@pkg/docker/entrypoint.sh`:
- Around line 68-69: The case branch that maps numeric 1/0 to boolean True/False
(the patterns "true|1) val=\"True\" ;; " and "false|0) val=\"False\" ;;") causes
integer PGADMIN_CONFIG_* options to become booleans; remove the "1" and "0"
alternatives from those case patterns so only literal boolean strings map to
True/False, or implement a type-aware conversion: detect keys like
PGADMIN_CONFIG_DEFAULT_SERVER_PORT, LOG_ROTATION_SIZE, LOG_ROTATION_AGE,
LOG_ROTATION_MAX_LOG_FILES, and MAX_SESSION_IDLE_TIME and preserve numeric
values (emit them unchanged) while still converting "true"/"false" to Python
True/False for non-integer keys.
🧹 Nitpick comments (2)
pkg/docker/entrypoint.sh (2)

64-71: Consider using ${!var} instead of eval for safer indirect expansion.

The script already uses bash indirect expansion (${!var}) in the file_env function (lines 19, 24, 26). Using eval here is less safe and inconsistent with the rest of the script. Additionally, if a value contains shell metacharacters, the eval approach could produce unexpected results.

♻️ Proposed refactor using indirect expansion
     for var in $(env | grep "^PGADMIN_CONFIG_" | cut -d "=" -f 1); do
-        # Get the raw value
-        val=$(eval "echo \"\$$var\"")
+        # Get the raw value using indirect expansion
+        val="${!var}"
         # This normalization step is what makes 'true', 'True', and 1 all work
         case "$(echo "$val" | tr '[:upper:]' '[:lower:]')" in
             true|1)  val="True" ;;
             false|0) val="False" ;;
         esac
         echo "${var#PGADMIN_CONFIG_} = $val" >> "${CONFIG_DISTRO_FILE_PATH}"
     done

61-62: Comment is inconsistent with the script's actual shell.

The comment states the container uses BusyBox/ash, but the shebang (line 1) specifies #!/usr/bin/env bash, and the script already uses bash-specific features like ${!var} indirect expansion in the file_env function. Consider updating the comment to reflect reality, or removing it since the suggested refactor above makes the code cleaner.

@akshay-joshi akshay-joshi merged commit 596b14a into pgadmin-org:master Jan 30, 2026
37 checks passed
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.

2 participants