polymorphm / pg-make-schemas

``pg-make-schemas`` is an utility for installing and upgrading database schemas from a revisioned source code repository.
MIT License
0 stars 0 forks source link

ability using pg_service and .pgpass for connect #3

Open 4orbit opened 1 year ago

4orbit commented 1 year ago

Please, add ability using .pg_service.conf and .pgpass for database connection instead hosts.yaml file

example: ./pg-make-schemas service=mydb ... not need any hosts.yaml in command line

https://gist.github.com/tym-xqo/33baf67bb332cebc4b20f7211dbedf59#file-example-py here may see example

https://www.cybertec-postgresql.com/en/pg_service-conf-the-forgotten-config-file/

polymorphm commented 1 year ago

I think it's not a bad idea to have an ability passing connstr directly in arguments (with generation of content hosts.yaml just in memory. not having it on file system).

so pass service=mydb could be possible if we make this improvements.

but of course it would work only in limited scenarios: only one db is versionised in the cluster.

so! I guess we can create two variants of passing connstr argument:

  1. two argument something like --db-type=mydb --connstr=service=mydb.
  2. only one argument something like --db-service=mydb (automaticly implies --db-type=mydb and --connstr=service=mydb). just a shortcut for variant "1." above.