View Source mix hex.organization (Hex v2.0.6)

Manages the list of authorized Hex.pm organizations.

Organizations is a feature of Hex.pm to host and manage private packages. See https://hex.pm/docs/private for more information.

By default you will be authorized to all your applications when running mix hex.user auth and this is the recommended approach. This task is mainly provided for a CI and build systems where access to an organization is needed without authorizing a user.

By authorizing a new organization a new key is created for fetching packages from the organizations repository and the repository key is stored on the local machine.

To use a package from an organization add organization: "my_organization" to the dependency declaration in mix.exs:

{:plug, "~> 1.0", organization: "my_organization"}

authorize-an-organization

Authorize an organization

This command will generate an API key used to authenticate access to the organization. See the hex.user tasks to list and control all your active API keys.

$ mix hex.organization auth ORGANIZATION  [--key KEY] [--key-name KEY_NAME]

deauthorize-and-remove-an-organization

Deauthorize and remove an organization

$ mix hex.organization deauth NAME

list-all-authorized-organizations

List all authorized organizations

This command will only list organizations you have authorized with this task, it will not list organizations you have access to by having authorized with mix hex.user auth.

$ mix hex.organization list

generate-organization-key

Generate organization key

This command is useful to pre-generate keys for use with mix hex.organization auth ORGANIZATION --key KEY on CI servers or similar systems. It returns the hash of the generated key that you can pass to auth ORGANIZATION --key KEY. Unlike the hex.user key commands, a key generated with this command is owned by the organization directly, and not the user that generated it. This makes it ideal for shared environments such as CI where you don't want to give access to user-specific resources and the user's organization membership status won't affect key. By default this command sets the repository:organization_name permission which allows read-only access to the organization's repository, it can be overridden with the --permission flag.

$ mix hex.organization key ORGANIZATION generate [--key-name KEY_NAME] [--permission PERMISSION]

revoke-key

Revoke key

Removes given key from organization.

The key can no longer be used to authenticate API requests.

$ mix hex.organization key ORGANIZATION revoke KEY_NAME

revoke-all-keys

Revoke all keys

Revoke all keys from the organization.

$ mix hex.organization key ORGANIZATION revoke --all

list-keys

List keys

Lists all keys associated with the organization.

$ mix hex.organization key ORGANIZATION list

command-line-options

Command line options

  • --key KEY - Hash of key used to authenticate HTTP requests to repository, if omitted will generate a new key with your account credentials. This flag is useful if you have a key pre-generated with mix hex.organization key and want to authenticate on a CI server or similar system

  • --key-name KEY_NAME - By default Hex will base the key name on your machine's hostname and the organization name, use this option to give your own name.

  • --permission PERMISSION - Sets the permissions on the key, this option can be given multiple times, possibly values are:

    • api:read - API read access.
    • api:write - API write access.
    • repository:organization_name - Access to the organization's repository (this is the default permission).