-
Notifications
You must be signed in to change notification settings - Fork 5
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
API Behaviour: authentication and switching between local db and API #280
Comments
Should the tests for the API only, or once for the API route, and once for the SQL route? For integration into github actions, only the API route makes sense. |
|
I'm now using a generic api helper instead of a api helper per function: 8d9a001 |
The code used for the main functions is very repetitive, and suitable for wrapping in a helper. This would make changes to this code easier in the future and would keep it DRY. However, it currently is immediately apparent what the main function is doing (some parsing, and passing arguments on to two helpers, one general, and one specific). Using a helper to do this, would detract from the functions being self explaining. |
Instead of having a helper function with almost the same code as That way we only have to maintain the functions in one place. |
Right, we currently need to maintain it in two places ... We could load |
I think loading etnservice as a dependency is the way forward, but for now I'll keep going ahead with a hard coded |
|
This is a technical issue to capture a discussion regarding the future migration of
ETN
to using an OpenCPU API.Function Naming
Functions will retain the same names, and no exported duplicate functions will be made.
The functions will allow users to switch between using the API, or a local database connection (as they do now on the RStudio Server instance).
Authentication and switching between the API and a local database connection
Authentication via the API uses an internal helper
get_credentials()
that gets the username/password from the environment (or later on, asks the user to fill them in, warns for missing/emptypwd
, uses keyring similar to move2)Users will be able to pass a
connection
argument as they do now, and if they do so,ETN
will try to use a local database connection. Old scripts will continue to work on the RStudio server. However, the contents of theconnection
argument are unused, as the SQL helper will use get_credentials() to build a connection argument for itself internally.If a user wants to run an old script locally, using the API, all they need to do is remove the connection argument.
If a user wants to use the local db, they set
API = FALSE
The API and local db helpers both use a
credentials
argument populated withget_credentials()
.main can be merged into this script that contains both helpers, the changes to main need to be merged manually into the sql helper
This allows for switching between api and local db use, allows for the reuse of existing scripts when run on the RStudio Server, allows adaptation of existing scripts with minimal effort (as no authentication argument needs to be added for functions to work)
Currently all functions require authentication, but in the future we can consider disabling authentication for functions that report data without an embargo: this is a database level change
Idea's
etnservice
as a dependency and drop_sql
helpers #316The text was updated successfully, but these errors were encountered: