Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Depends:
R (>= 4.4.0)
Imports:
arrow,
AzureAuth,
azkit,
AzureStor,
bs4Dash,
cachem,
Expand Down Expand Up @@ -69,7 +69,8 @@ Suggests:
usethis,
watchr (>= 0.0.0.9000)
Remotes:
github::tomjemmett/watchr
github::tomjemmett/watchr,
github::the-strategy-unit/azkit
Config/testthat/edition: 3
Encoding: UTF-8
Language: en-GB
Expand Down
21 changes: 6 additions & 15 deletions R/fct_azure_storage.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,14 @@ load_provider_data <- function(

#' Get ADLS Filesystem
#'
#' try to use a managed token, this will only work if run in an Azure data centre
#' if it fails, try instead to use Azure Resource Manager
#' Get the Azure Data Lake Storage filesystem using the endpoint and container
#' specified in environment variables. (AZ_STORAGE_EP and AZ_STORAGE_CONTAINER)
#'
#' @return the adls filesystem
get_adls_fs <- function() {
ep_uri <- Sys.getenv("LOCAL_STORAGE_EP")
token <- azkit::get_auth_token()

ep <- if (ep_uri != "") {
sa_key <- Sys.getenv("LOCAL_STORAGE_KEY")

AzureStor::adls_endpoint(ep_uri, key = sa_key)
} else {
ep_uri <- Sys.getenv("AZ_STORAGE_EP")
token <- AzureAuth::get_managed_token("https://storage.azure.com/") |>
AzureAuth::extract_jwt()

AzureStor::adls_endpoint(ep_uri, token = token)
}
AzureStor::adls_filesystem(ep, Sys.getenv("AZ_STORAGE_CONTAINER"))
Sys.getenv("AZ_STORAGE_EP") |>
AzureStor::adls_endpoint(token = token) |>
AzureStor::adls_filesystem(Sys.getenv("AZ_STORAGE_CONTAINER"))
Comment thread
tomjemmett marked this conversation as resolved.
}
4 changes: 2 additions & 2 deletions man/get_adls_fs.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.