-
Notifications
You must be signed in to change notification settings - Fork 84
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
Fix checking and logging of envVars
in deployApp()
#994
base: main
Are you sure you want to change the base?
Changes from 2 commits
6d4ae9d
523f1e5
f3dac5b
28531f1
0c9bfbf
8a74325
4a88330
dfe66d5
f1227e4
dd12337
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -360,7 +360,7 @@ deployApp <- function(appDir = getwd(), | |
stop("Posit Connect does not support deploying without uploading. ", | ||
"Specify upload=TRUE to upload and re-deploy your application.") | ||
} | ||
if (!isConnectServer(target$server) && length(envVars) > 1) { | ||
if (!isConnectServer(target$server) && length(envVars) > 0) { | ||
cli::cli_abort("{.arg envVars} only supported for Posit Connect servers") | ||
} | ||
|
||
|
@@ -432,7 +432,7 @@ deployApp <- function(appDir = getwd(), | |
taskComplete(quiet, "Visibility updated") | ||
} | ||
if (length(target$envVars) > 0) { | ||
taskStart(quiet, "Updating environment variables {envVars}...") | ||
taskStart(quiet, "Updating {length(envVars)} environment variable{?s}: {.field {names(envVars)}}...") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These are already just the names of the env vars? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I had a hard time following the flow for that property. What happened for me -- before I applied the other fix -- was that I tried to deploy an app with one env var to shinyapps.io. Something like I made this change first and then realized that the earlier check was failing, and in my probably semi-broken state There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, maybe we need some earlier validation that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ohhh, I read the documentation more carefully and realized that the environment variables should be set in the current session and the user should provide just the names, as in I think my confusion stemmed from being familiar with connectapi, where there's an interface for setting environment variables during deployment that uses the I updated the docs to give a little guidance about how those values should be set, and I added a check that the vector provided to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In case it's not clear, the interface looks like this is to prevent you from typing the values of env vars in executed code since that will be captured in |
||
client$setEnvVars(application$guid, target$envVars) | ||
taskComplete(quiet, "Environment variables updated") | ||
} | ||
|
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.
Rather than checking here by enforcing that
target$server
points to a Connect server, you could instead check just a little bit further down after creatingclient
. In that case, you could use a block like the following, and check thatclient
implements thesetEnvVars()
psuedo-method.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 like that idea. Want to do it?
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.
No problem, done in f3dac5b