ciaranj commented on issue #31983: URL: https://github.com/apache/superset/issues/31983#issuecomment-2730398728
This is also a problem in 4.1.1. In case it helps anyone out in the meantime, superset set-database-uri **does** appear to ensure that the password appears masked to the end user in the UI. Because I want to **both** maintain the UUID of the database **and** be able to control the username/password through environment secrets in my container, I'm currently doing an import directory (to enforce the UUID) and a call to set-database-uri (to enforce the password masking.) I'm doing this by re-writing the initscript in the helm chart, to allow for the container to change the username/password it's using. YMMV, but here's mine: `` init: initscript: |- #!/bin/sh set -eu echo "Upgrading DB schema..." superset db upgrade echo "Initializing roles..." superset init urlencode() { string="$1" encoded="" pos=0 while [ "$pos" -lt "${#string}" ]; do c=$(printf "%s" "$string" | cut -c $((pos + 1))) case "$c" in [a-zA-Z0-9.~_-]) o="$c" ;; *) o=$(printf '%%%02X' "'$c") ;; esac encoded="$encoded$o" pos=$((pos + 1)) done echo "$encoded" } echo "Configuring default database" mkdir /tmp/datasources date_now=$(date -u +"%Y-%m-%dT%H:%M:%SZ") user=$(urlencode "$USER" ) password=$(urlencode "$PASSWORD" ) server=$(urlencode "$DB_SERVER" ) dbName=$(urlencode "$DB_NAME" ) conn_str=$( echo "mssql+pymssql://$user:$password@$server:1433/$dbName" ) echo $conn_str mkdir /tmp/datasources/databases cat > /tmp/datasources/metadata.yaml <<EOT version: 1.0.0 type: Database timestamp: '$date_now' EOT cat > /tmp/datasources/databases/DB.yaml <<EOT database_name: DB sqlalchemy_uri: $conn_str cache_timeout: null expose_in_sqllab: true allow_run_async: false allow_ctas: false allow_cvas: false allow_dml: false allow_file_upload: false extra: allows_virtual_table_explore: true uuid: 738f72b0-651b-4d60-9968-dc3d3064c149 version: 1.0.0 EOT echo "Importing database connections from constructed local files" superset import-directory /tmp/datasources -o echo "Re-Importing database connections to work around https://github.com/apache/superset/issues/31983" superset set-database-uri -d Lokulus -u $conn_str -s `` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org