Skip to content

Commit

Permalink
rename MUJOCOJL_TEST_KEY to MUJOCO_KEY
Browse files Browse the repository at this point in the history
  • Loading branch information
colinxs authored and Colin Summers committed Jan 16, 2020
1 parent aa25b7f commit b893c67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ jobs:
- uses: julia-actions/julia-buildpkg@master
- uses: julia-actions/julia-runtest@master
env:
MUJOCOJL_TEST_KEY: ${{ secrets.MUJOCOJL_TEST_KEY }}
MUJOCO_KEY: ${{ secrets.MUJOCO_KEY }}

2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
run: julia --project=docs/ -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd())); Pkg.instantiate()'
- name: Build and deploy
env:
MUJOCOJL_TEST_KEY: ${{ secrets.MJKEY }}
MUJOCO_KEY: ${{ secrets.MUJOCO_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # For authentication with GitHub Actions token
DOCUMENTER_KEY: ${{ secrets.LYCEUMBOT_DEPLOY_KEY}}
run: julia --project=docs/ docs/make.jl
14 changes: 7 additions & 7 deletions src/MJCore/MJCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const MJVec{T} = MJArray{T,1}
const MJMat{T} = MJArray{T,2}

const ERRORSIZE = 1000
const MJKEY_ENV_VAR = "MUJOCO_KEY_PATH"
const MJTESTKEY_ENV_VAR = "MUJOCOJL_TEST_KEY"
const KEY_PATH_ENV_VAR = "MUJOCO_KEY_PATH"
const KEY_ENV_VAR = "MUJOCO_KEY"

const ACTIVATED = Ref(false)
isactivated() = ACTIVATED[]
Expand Down Expand Up @@ -50,13 +50,13 @@ function __init__()
MJCore.CGlobals.mju_user_warning = warncb
MJCore.CGlobals.mju_user_error = errcb

if !isactivated() && haskey(ENV, MJKEY_ENV_VAR)
path = normpath(ENV[MJKEY_ENV_VAR])
if !isactivated() && haskey(ENV, KEY_PATH_ENV_VAR)
path = normpath(ENV[KEY_PATH_ENV_VAR])
isfile(path) || @mjerror "activating with key $path: No such file or directory"
ACTIVATED[] = Bool(mj_activate(path))
isactivated() || @mjerror "activating with key $path: invalid key"
elseif !isactivated() && haskey(ENV, MJTESTKEY_ENV_VAR)
mjkey = ENV[MJTESTKEY_ENV_VAR]
elseif !isactivated() && haskey(ENV, KEY_ENV_VAR)
mjkey = ENV[KEY_ENV_VAR]
mktemp() do path, io
write(io, String(base64decode(mjkey)))
flush(io)
Expand All @@ -66,7 +66,7 @@ function __init__()
else
@warn """
No key found. Please set the env variable $MJKEY_ENV_VAR to point to a valid `mjkey` file.
No key found. Please set the env variable $KEY_PATH_ENV_VAR to point to a valid `mjkey` file.
Alternatively, use `mj_activate(path_to_mjkey.txt)` to manually activate.
"""
end
Expand Down

0 comments on commit b893c67

Please # to comment.