stac-utils / pgstac

Schema, functions and a python library for storing and accessing STAC collections and items in PostgreSQL
MIT License
153 stars 39 forks source link

Allow docker entrypoint to execute `psql` command in shell script if `PGHOST` is set #319

Open mishaschwartz opened 5 days ago

mishaschwartz commented 5 days ago

This resolves #318 by temporarily making the psql command an alias for docker_process_sql and exporting it so that it can be used in executed shell scripts.

This change is only applied for the duration of the docker_process_init_files function so it should not affect any other calls to psql in the container.

To test this:

docker run --rm -e 'POSTGRES_USER=username' -e 'PGUSER=username' -e 'POSTGRES_PASSWORD=password' -e 'POSTGRES_DB=postgis' -e 'PGDATABASE=postgis' -e 'PGHOST=localhost' ghcr.io/stac-utils/pgstac:v0.9.1 postgres

The above command should run with no failures