This is an automated email from the ASF dual-hosted git repository.

xiangying pushed a commit to branch branch-0.5.0
in repository https://gitbox.apache.org/repos/asf/pulsar-manager.git

commit f09b884c919950e9a748d70bc46c3c50d25db251
Author: Martin <43972560+mortom...@users.noreply.github.com>
AuthorDate: Wed Apr 3 19:45:52 2024 +0200

    fix init_db.sql to also take variables from environment (#556)
    
    * fix init_db.sql to also take variables from environment
    
    * make other occurrences of username dynamic
    
    * Update docker/init_db.sql
    
    Co-authored-by: Lari Hotari <lhot...@users.noreply.github.com>
    (cherry picked from commit 3e5430cad65cdecdc698f9e8b3f68cae4d083b1c)
---
 docker/init_db.sql | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/docker/init_db.sql b/docker/init_db.sql
index f6bd697..a835251 100644
--- a/docker/init_db.sql
+++ b/docker/init_db.sql
@@ -12,9 +12,12 @@
 -- limitations under the License.
 --
 
-ALTER USER pulsar WITH PASSWORD 'pulsar';
-CREATE DATABASE pulsar_manager OWNER pulsar;
-GRANT ALL PRIVILEGES ON DATABASE pulsar_manager to pulsar;
+\set username `echo "${USERNAME:-pulsar}"`
+\set password `echo "${PASSWORD:-pulsar}"`
+
+ALTER USER :username WITH PASSWORD :'password';
+CREATE DATABASE pulsar_manager OWNER :username;
+GRANT ALL PRIVILEGES ON DATABASE pulsar_manager to :username;
 
 \c pulsar_manager;
 

Reply via email to