@@ -272,19 +272,6 @@ docker_process_init_files() {
272272 done
273273}
274274
275- # create_database_from_env creates a database if the DATABASE environment variable is set.
276- # It retrieves the database name from environment the env var DATABASE
277- # and attempts to create the database using exec_sql.
278- create_database_from_env () {
279- local database
280- database=$( get_env_var " DB" )
281-
282- if [ -n " $database " ]; then
283- note " Creating database '${database} '"
284- exec_sql " Failed to create database '$database ': " " CREATE DATABASE IF NOT EXISTS \" $database \" ;"
285- fi
286- }
287-
288275# is_port_open checks if a TCP port is open on a given host.
289276# Arguments:
290277# $1 - Host (IP or hostname)
@@ -310,12 +297,14 @@ start_server() {
310297 local start_time
311298 start_time=$( date +%s)
312299
313- # If either of the doltgres or postgres specific user and password env vars are set, export them
300+ # If any of the doltgres or postgres specific user, password, and DB env vars are set, export them
314301 # to the ones that doltgres understands so they can be used during initialization.
315302 user=$( get_env_var " USER" )
316303 password=$( get_env_var " PASSWORD" )
304+ db=$( get_env_var " DB" )
317305 export DOLTGRES_USER=$user
318306 export DOLTGRES_PASSWORD=$password
307+ export DOLTGRES_DB=$db
319308
320309 SERVER_PID=-1
321310
@@ -419,8 +408,6 @@ _main() {
419408
420409 start_server " $@ "
421410
422- create_database_from_env
423-
424411 if [[ ! -f $INIT_COMPLETED ]]; then
425412 if ls /docker-entrypoint-initdb.d/* > /dev/null 2>&1 ; then
426413 docker_process_init_files /docker-entrypoint-initdb.d/*
0 commit comments