Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration #5

Closed
g4s8 opened this issue Oct 15, 2021 · 0 comments · Fixed by #7
Closed

Configuration #5

g4s8 opened this issue Oct 15, 2021 · 0 comments · Fixed by #7
Assignees

Comments

@g4s8
Copy link
Member

g4s8 commented Oct 15, 2021

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:

  • endpoint for endpoint URI
  • auth-user user for auth
  • auth-password password for auth
  • auth-token token for auth

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
@g4s8 g4s8 closed this as completed in #7 Nov 15, 2021
g4s8 pushed a commit that referenced this issue Nov 15, 2021
Implement `Config`, `Context` and `Auth` structs. Added methods to parse and validate config.

Close: #5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants