-
Notifications
You must be signed in to change notification settings - Fork 1
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
Allow unauthenticated users to connect to an instance #19
Conversation
R/connect.R
Outdated
if (file.exists(instance_file)) { | ||
.settings_load__load_instance_settings(instance_file) | ||
} else { | ||
# try to load the user settings from the api | ||
user_file <- .settings_store__current_user_settings_file() | ||
|
||
if (!file.exists(user_file)) { | ||
cli_abort(paste0( | ||
"No default user or instance is loaded! Either:\n", | ||
" - Call `lamin login` to set a default user.\n", | ||
" - Call `lamin load <slug>` to set a default instance.\n" | ||
)) | ||
} else { | ||
user_settings <- .settings_load__load_user_settings(user_file) | ||
|
||
.connect_get_instance_settings( | ||
owner = owner_name$owner, | ||
name = owner_name$name, | ||
access_token = user_settings$access_token | ||
) | ||
} | ||
} |
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.
If the instance settings file does not exist, we could try running lamin load ${slug}
ourselves, as opposed to throwing an error message. @lazappi wdyt?
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.
For now I would probably leave the setup stuff to the command line, just for easiness. If Python lets you do this then maybe it would be nice to add later.
R/InstanceSettings.R
Outdated
"db_user_password" | ||
"api_url" | ||
) | ||
optional_columns <- c( |
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.
Would it be clearer to call these "settings" or something rather than columns?
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.
good point -- done!
R/connect.R
Outdated
if (file.exists(instance_file)) { | ||
.settings_load__load_instance_settings(instance_file) | ||
} else { | ||
# try to load the user settings from the api | ||
user_file <- .settings_store__current_user_settings_file() | ||
|
||
if (!file.exists(user_file)) { | ||
cli_abort(paste0( | ||
"No default user or instance is loaded! Either:\n", | ||
" - Call `lamin login` to set a default user.\n", | ||
" - Call `lamin load <slug>` to set a default instance.\n" | ||
)) | ||
} else { | ||
user_settings <- .settings_load__load_user_settings(user_file) | ||
|
||
.connect_get_instance_settings( | ||
owner = owner_name$owner, | ||
name = owner_name$name, | ||
access_token = user_settings$access_token | ||
) | ||
} | ||
} |
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.
For now I would probably leave the setup stuff to the command line, just for easiness. If Python lets you do this then maybe it would be nice to add later.
R/connect.R
Outdated
if (file.exists(instance_file)) { | ||
.settings_load__load_instance_settings(instance_file) | ||
} else { | ||
# try to load the user settings from the api | ||
user_file <- .settings_store__current_user_settings_file() | ||
|
||
if (!file.exists(user_file)) { | ||
cli_abort(paste0( | ||
"No default user or instance is loaded! Either:\n", | ||
" - Call `lamin login` to set a default user.\n", | ||
" - Call `lamin load <slug>` to set a default instance.\n" | ||
)) | ||
} else { |
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.
Could this be combined with the similar chunk above? Possibly the logic is easier this way though.
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.
Yes -- and indeed!
Allow unauthenticated users to query an instance if they ran
lamin load <instance>
beforehand