You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/PkgAuthentication.jl
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -32,14 +32,17 @@ function _assert_pkg_server_env_var_is_set()
32
32
end
33
33
34
34
"""
35
-
authenticate(server::AbstractString)
35
+
authenticate(server::AbstractString; kwargs...)
36
36
37
37
Starts interactive (blocking) browser-based Pkg server authentication for the Pkg
38
38
server specified by `server`. Also sets the `$(pkg_server_env_var_name)` environment
39
39
variable to `server`.
40
40
41
41
`server` must be the URL of a valid Pkg server.
42
42
43
+
## Keyword arguments
44
+
- `modify_environment::Bool = true`: Set the `$(pkg_server_env_var_name)` environment variable to `server`. In package code, this should probably be set to `false`, so that the package would not have unexpected global side effects.
45
+
43
46
## Example usage
44
47
45
48
```julia
@@ -51,13 +54,20 @@ function authenticate(
51
54
auth_suffix::Union{String, Nothing}=nothing,
52
55
force::Union{Bool, Nothing}=nothing,
53
56
tries::Union{Integer, Nothing}=nothing,
57
+
modify_environment::Bool=true,
54
58
)::Union{Success, Failure}
55
-
ENV[pkg_server_env_var_name] = server
56
-
authenticate(;
57
-
auth_suffix = auth_suffix,
58
-
force = force,
59
-
tries = tries,
60
-
)
59
+
if modify_environment
60
+
ENV[pkg_server_env_var_name] = server
61
+
end
62
+
# Even if `modify_environment` is `false`, we still need to set the environment
63
+
# variable for the duration of the `authenticate` call.
0 commit comments