mirror of
				https://github.com/cookiecutter/cookiecutter-django.git
				synced 2025-11-04 01:47:28 +03:00 
			
		
		
		
	Refactor POSTGRES_PORT env
This commit is contained in:
		
							parent
							
								
									906299ae39
								
							
						
					
					
						commit
						17739ff263
					
				| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
# PostgreSQL
 | 
			
		||||
# ------------------------------------------------------------------------------
 | 
			
		||||
POSTGRES_HOST=postgres
 | 
			
		||||
POSTGRES_PORT=5432
 | 
			
		||||
POSTGRES_DB={{ cookiecutter.project_slug }}
 | 
			
		||||
POSTGRES_USER=!!!SET POSTGRES_USER!!!
 | 
			
		||||
POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!!
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
# PostgreSQL
 | 
			
		||||
# ------------------------------------------------------------------------------
 | 
			
		||||
POSTGRES_HOST=postgres
 | 
			
		||||
POSTGRES_PORT=5432
 | 
			
		||||
POSTGRES_DB={{ cookiecutter.project_slug }}
 | 
			
		||||
POSTGRES_USER=!!!SET POSTGRES_USER!!!
 | 
			
		||||
POSTGRES_PASSWORD=!!!SET POSTGRES_PASSWORD!!!
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -14,7 +14,7 @@ if [ -z "${POSTGRES_USER}" ]; then
 | 
			
		|||
    base_postgres_image_default_user='postgres'
 | 
			
		||||
    export POSTGRES_USER="${base_postgres_image_default_user}"
 | 
			
		||||
fi
 | 
			
		||||
export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}"
 | 
			
		||||
export DATABASE_URL="postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}"
 | 
			
		||||
 | 
			
		||||
postgres_ready() {
 | 
			
		||||
python << END
 | 
			
		||||
| 
						 | 
				
			
			@ -27,7 +27,8 @@ try:
 | 
			
		|||
        dbname="${POSTGRES_DB}",
 | 
			
		||||
        user="${POSTGRES_USER}",
 | 
			
		||||
        password="${POSTGRES_PASSWORD}",
 | 
			
		||||
        host="${POSTGRES_HOST}"
 | 
			
		||||
        host="${POSTGRES_HOST}",
 | 
			
		||||
        port="${POSTGRES_PORT}",
 | 
			
		||||
    )
 | 
			
		||||
except psycopg2.OperationalError:
 | 
			
		||||
    sys.exit(-1)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -26,6 +26,7 @@ if [[ "${POSTGRES_USER}" == "postgres" ]]; then
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
export PGHOST="${POSTGRES_HOST}"
 | 
			
		||||
export PGPORT="${POSTGRES_PORT}"
 | 
			
		||||
export PGUSER="${POSTGRES_USER}"
 | 
			
		||||
export PGPASSWORD="${POSTGRES_PASSWORD}"
 | 
			
		||||
export PGDATABASE="${POSTGRES_DB}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -38,6 +38,7 @@ if [[ "${POSTGRES_USER}" == "postgres" ]]; then
 | 
			
		|||
fi
 | 
			
		||||
 | 
			
		||||
export PGHOST="${POSTGRES_HOST}"
 | 
			
		||||
export PGPORT="${POSTGRES_PORT}"
 | 
			
		||||
export PGUSER="${POSTGRES_USER}"
 | 
			
		||||
export PGPASSWORD="${POSTGRES_PASSWORD}"
 | 
			
		||||
export PGDATABASE="${POSTGRES_DB}"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user