Skip to content

Commit

Permalink
Merge pull request #90 from janjagusch/add-auth-argument
Browse files Browse the repository at this point in the history
Add --auth arg
  • Loading branch information
mariusvniekerk authored Mar 24, 2021
2 parents 8d34a4f + 189ed5f commit d1ddecc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ is being built from support them). This can be disabled easily
conda-lock --no-dev-dependencies -f ./recipe/meta.yaml
```

#### --strip-auth and --auth-file
#### --strip-auth, --auth and --auth-file

By default `conda-lock` will leave basic auth credentials for private conda channels in the lock file. If you wish to strip authentication from the file, provide the `--strip-auth` argument.

Expand All @@ -95,7 +95,7 @@ In order to `conda-lock install` a lock file with its basic auth credentials str
}
```

Then, you need to provide the path to the authentication file through the `--auth-file` argument.
You can provide the authentication either as string through `--auth` or as a filepath through `--auth-file`.

```
conda-lock install --auth-file auth.json conda-linux-64.lock
Expand Down
9 changes: 7 additions & 2 deletions conda_lock/conda_lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,11 +728,16 @@ def lock(
)
@click.option("-p", "--prefix", help="Full path to environment location (i.e. prefix).")
@click.option("-n", "--name", help="Name of environment.")
@click.option(
"--auth",
help="The auth file provided as string. Has precedence over `--auth-file`.",
default="",
)
@click.option("--auth-file", help="Path to the authentication file.", default="")
@click.argument("lock-file")
def install(conda, mamba, micromamba, prefix, name, lock_file, auth_file):
def install(conda, mamba, micromamba, prefix, name, lock_file, auth, auth_file):
"""Perform a conda install"""
auth = read_json(auth_file) if auth_file else None
auth = json.loads(auth) if auth else read_json(auth_file) if auth_file else None
_conda_exe = determine_conda_executable(conda, mamba=mamba, micromamba=micromamba)
install_func = partial(do_conda_install, conda=_conda_exe, prefix=prefix, name=name)
if auth:
Expand Down

0 comments on commit d1ddecc

Please sign in to comment.