conda-mirror
conda-mirror copied to clipboard
Support custom channel settings
Any custom channel aliases configured in the user's .condarc file should be recognized so that users can write the alias instead of having to write out the full URL.
E.g. If you have:
custom_channels:
my-channel: https://my-custom-server.com/
you should be able to specify my-channel
as the channel rather than https://my-custom-server.com/my-channel
To support this we would either need to run conda config --show custom_channels --json
and parse the output or find the appropriate .condarc
file (see https://docs.conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#searching-for-condarc). I believe that conda reads all of the config files it can find in the search path in order and applies the keys, so the last file that specifies custom_channels is the correct one.
Probably easier to just call conda config
.
Note that if you run conda config
without --json
then the auth and token portions of the
original URL will be omitted, which is probably not what you want, so you will need to reconstruct
the URL from the fields reported in the json records.
Note that if you run
conda config
without--json
then the auth and token portions of the original URL will be omitted, which is probably not what you want, so you will need to reconstruct the URL from the fields reported in the json records.
Worth pointing out that folks should really be using .netrc files for auth as conda will automatically insert the authentication into the URL as appropriate.
Worth pointing out that folks should really be using .netrc files for auth as conda will automatically insert the authentication into the URL as appropriate.
Good to know. There is no mention of that in the conda docs.
I think support for that should be in a separate ticket since it applies to all HTTP urls, not just those in custom channels.
FYI, here is the conda code.