Skip to content

Commit

Permalink
Add example of setup with pats kwarg
Browse files Browse the repository at this point in the history
Add example to docs. Closes #17.
  • Loading branch information
Nosferican committed Jan 29, 2021
1 parent 4c7bcd6 commit d1332ec
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/01_BaseUtils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ Sets up your PostgreSQL database for the project.
# Example
```julia-repl
julia> setup(pats = [GitHubPersonalAccessToken("MyGH_Login", ENV["GH_PAT"])])
```
```julia-repl
julia> setup()
Expand Down Expand Up @@ -169,7 +174,7 @@ function setup(;host::AbstractString = get(ENV, "PGHOST", "localhost"),
pat = DataFrame(execute(GHOST.PARALLELENABLER.conn, "SELECT login, token FROM $schema.pats ORDER BY login LIMIT 1;"))
GHOST.PARALLELENABLER.pat = only(GitHubPersonalAccessToken.(pat.login, pat.token))
catch err
throw(ArgumentError("No PAT was provided nor available in the database."))
throw(ArgumentError("No PAT was provided nor available in the database. You can provide PAT directly through `setup` using the keyword argument `pats`."))
end
else
pats = DataFrame((login = pat.login, token = pat.token) for pat in pats)
Expand Down

0 comments on commit d1332ec

Please sign in to comment.