Open jimsimon opened 4 years ago
That's a good idea! Feel free to make a PR to add this feature in pmt
Adding on to this, I think it would be beneficial to allow us to resolve the URL with a function. This would allow us to create our own adapters to the URLs.
Environment variables could be resolved with this:
(alias) => process.env[alias]
The issue with resolving URL with a function is that other commands of pmt (e.g: migrate, studio,...) would not work.
However, if you only want the pmt client, you could use the .directGet
method instead of .get
. (See documentation)
The current approach requires storing usernames and passwords for the database connection strings in plain text which isn't great for security. A better approach might be to use an alias and environment variables for retrieving the connection strings.
Tenant Table:
.env
This could be done in a backwards compatible way by making the current URL column nullable and adding a new alias column. Then use URL if it's present and fall back to alias. The CLI would just need to ensure that one of the two are provided, and a check constraint could be used on the table to ensure it never ends up in a situation where both columns are null.