artipie / artipie-cli

Command line instrument for managing Artipie server
MIT License
11 stars 2 forks source link

Configuration #5

Closed g4s8 closed 2 years ago

g4s8 commented 2 years ago

Artipie CLI should parse configuration file and same global configuration options.

File

The file could be checked in order $HOME/.config/artictl/config.yaml, /etc/artictl/config.yaml. File should contain different context sections (for different servers), and ID of current context. Each context should have mandatory endpoint URI and authentication options. Endpoint is just a URI string, authentication options could be different, it's either user+password or auth token.

Example:

currentContext: "default"
contexts:
  default:
    auth:
      token: "123456"
    endpoint: https:/central.artipie.com
  myLocal:
    auth:
      username: test
      password: qwerty
    endpoint: http://artipie.local/artipie

CLI uses currentContext but can choose another one: articl --context=myLocal get repo

Options

The same parameters could be provided as global options for CLI:

CLI options has higher priority that config file options and CLI should use options on conflict. auth-user and auth-password should be used only together. It should be not possible to use auth-token with auth-user or auth-password.

Examples:

artictl --endpoint=https://central.artipie.com get repo
artictl --auth-token=12345 get repo
artictl --auth-user=test --auth-password=qwerty get repo