-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running PostgREST with zero config #2112
Conversation
1a44a3d
to
68d8d7b
Compare
3b12ddf
to
5f4898c
Compare
There are a few comments from the related issues, that are still open / to discuss:
This is not the case right now. I briefly thought about exiting with an error in that case... but since both config settings can be loaded from the database after a notify, I don't think we should do that. This will allow to start postgrest, but disable any access while the database schema is being loaded into the database. At the end of the init script, the anon role and JWT secret can be set and a We do have error messages for both anonymous requests and authenticated requests, when either the anon role or the secret is missing - so it will be pretty obvious what's happening.
This might be different... but then again I really hate warnings I receive when I do something like that and am perfectly fine with the default. The problem is then, that I can't disable the warning. Annoying. But yeah, I guess that's still up for debate. Opinions? |
I think these are all valid points.
Maybe instead of warnings, postgrest can print info statements on startup stating what configuration it is being started up with. The interpretation will then be up to user whether it is a good or bad thing. However, I don't think this is a must since default functionality is already documented. |
I'd certainly like that much more. While messing with some of the io tests I also missed something like Or, other idea: What if we add some kind of |
I think that would be a nice enhancement. Other platforms, if enabled, (like hibernate) also dump such debug statistics and information including raw sql queries generated by query builder. |
… where possible. Load jwt secret from file instead of stdin in tests, because stdin is not supported when reloading the config. Resolves PostgREST#2126.
The default is now "postgresql://" which falls back to LIBPQ environment variables. Resolves PostgREST#1991, Ref PostgREST#1823
Resolves PostgREST#1769, Ref PostgREST#1823
5f4898c
to
1f59c5c
Compare
Without db-anon-role, PostgREST will block any anonymous access without hitting the database. Resolves PostgREST#1689, Ref PostgREST#1823
1f59c5c
to
d9e016b
Compare
I think I broke the memory tests somehow. They are timing out now, not failing, so I didn't notice earlier. Will have to investigate. |
@@ -25,7 +25,6 @@ let | |||
"ARG_USE_ENV([PGUSER], [postgrest_test_authenticator], [Authenticator PG role])" | |||
"ARG_USE_ENV([PGDATABASE], [postgres], [PG database name])" | |||
"ARG_USE_ENV([PGRST_DB_SCHEMAS], [test], [Schema to expose])" | |||
"ARG_USE_ENV([PGRST_DB_ANON_ROLE], [postgrest_test_anonymous], [Anonymous PG role])" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing this one(and the below export PGRST_DB_ANON_ROLE
) because when doing:
postgrest-with-postgresql-13 postgrest-run
I can no longer make quick tests with the anon role. I can add PGRST_DB_ANON_ROLE=postgrest_test_anonymous
but that's more inconvenient(no autocompletion).
@wolfgangwalther Can I add this back? What would be the drawback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I think the idea was to make the posgrest-with-postgresql-xx
helpers more independent of the actual schema they are are loading. The files to load can be changed with -f
, I think. And we do so for IO tests and loadtest.
I think I just forgot to add a db role setting in the spec schema for the anonymous role. The tests didn't fail, because the spec tests have a separate config for that anyway. But to be able to load the spec schema with postgrest-run
it would be good to have that db setting.
And I'd go one step further: We should move the schema setting into the db config, too. No need to hardcode test
here for all.
Working on #1689, #1769, #1823 and #1991 here.
TODO:
db-anon-role