Hex v0.20.0 mix hex.config View Source

List config keys and values

mix hex.config

Get or delete config value for KEY

mix hex.config KEY [--delete]

Set config KEY to VALUE

mix hex.config KEY VALUE

Config keys

  • api_key - Your API key. If you are authenticated this config will override the API key used for your authenticated user. Can be also be overridden by setting the environment variable HEX_API_KEY
  • api_url - Hex API URL. Can be overridden by setting the environment variable HEX_API_URL (Default: "https://hex.pm/api")
  • offline - If set to true Hex will not fetch the registry or packages and will instead use locally cached files if they are available. Can be overridden by setting the environment variable HEX_OFFLINE (Default: false)
  • unsafe_https - If set to true Hex will not verify HTTPS certificates. Can be overridden by setting the environment variable HEX_UNSAFE_HTTPS (Default: false)
  • unsafe_registry - If set to true Hex will not verify the registry signature against the repository's public key. Can be overridden by setting the environment variable HEX_UNSAFE_REGISTRY (Default: false)
  • no_verify_repo_origin - If set to true Hex will not verify the registry origin. Can be overridden by setting the environment variable HEX_NO_VERIFY_REPO_ORIGIN (Default: false)
  • http_proxy - HTTP proxy server. Can be overridden by setting the environment variable HTTP_PROXY (Default: nil)
  • https_proxy - HTTPS proxy server. Can be overridden by setting the environment variable HTTPS_PROXY (Default: nil)
  • http_concurrency - Limits the number of concurrent HTTP requests in flight. Can be overridden by setting the environment variable HEX_HTTP_CONCURRENCY (Default: 8)
  • http_timeout - Sets the timeout for HTTP requests in seconds. Can be overridden by setting the environment variable HEX_HTTP_TIMEOUT (Default: nil)
  • mirror_url - Hex mirror URL. Can be overridden by setting the environment variable HEX_MIRROR (Default: nil)

HEX_HOME environment variable can be set to point to the directory where Hex stores the cache and configuration (Default: ~/.hex)

Config overrides

All keys from the "Config keys" section above can be overriden.

Hex uses the following order of precedence when computing a value for a given key:

  1. System environment

    Setting for example HEX_API_URL environemnt variable has always the highest precedence for the api_url config key.

  2. Project configuration

    Hex allows an optional, per-project configuration in the mix.exs file.

    For example, to override api_url config key, add the following:

     # mix.exs
     defmodule MyApp.MixProject
       def project() do
         [
           # ...
           deps: deps(),
           hex: hex()
         ]
       end
    
       defp hex() do
         [
           api_url: "https://hex.myorg/api"
         ]
       end
     end
  3. Global configuration using mix hex.config KEY VALUE

  4. Default value

Command line options

  • --delete - Remove a specific config key