Skip to content

Commit

Permalink
Merge pull request #176 from natverse/feature/rstudio-connection
Browse files Browse the repository at this point in the history
Add rstudio connection pane
  • Loading branch information
jefferis authored Oct 6, 2024
2 parents 1117fdc + 6d54d60 commit 407f5a5
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/conn.R
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ neuprint_connection <- function(server=NULL, token=NULL, dataset=NULL,
# we will always add one in our calls
neuprint_server <- remove_trailing_slash(neuprint_server)
# Set a default token if none specified
neuprint_token <- if(is.null(token)) unlist(getenvoroption("token")) else token
neuprint_token <- if(is.null(token) || !nzchar(token)) unlist(getenvoroption("token")) else token
# collect any curl options defined as environment variables
config=neuprint_curl_options(config)
conn=list(server = neuprint_server, token = neuprint_token, config=config,
Expand Down
Binary file added inst/images/neuprint-favicon-196x196.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions inst/rstudio/connections.dcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Name: Janelia-Neuprint
HelpUrl: https://github.com/natverse/neuprintr?tab=readme-ov-file#authentication
Icon: images/neuprint-favicon-196x196.png
15 changes: 15 additions & 0 deletions inst/rstudio/connections/Janelia-Neuprint.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
library(neuprintr)

connspec <- neuprintr::neuprint_connection(
server="${1:Server=https$colon$//neuprint.janelia.org}",
token = "${2:Neuprint Token=}",
dataset = "${3:Dataset=hemibrain$colon$v1.2.1}"
)
if(!nzchar(connspec$token)) {
connspec$token=neuprintr:::getenvoroption('token')[[1]]
if(is.null(connspec$token))
stop("Sorry you must either specify your neuprint token directly\n",
"or set the NEUPRINT_TOKEN environment variable!")
}

conn <- neuprintr::neuprint_login(connspec)

0 comments on commit 407f5a5

Please sign in to comment.