feat/Add: Configuration command to Manage System Configuration#114
feat/Add: Configuration command to Manage System Configuration#114bupd wants to merge 2 commits into
Conversation
This command fetches and stores the system config in the harbor config file. Signed-off-by: bupd <bupdprasanth@gmail.com>
Signed-off-by: bupd <bupdprasanth@gmail.com>
|
Is there anything preventing this from being merged? (Except for the merge conflict) |
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces a configuration management command to the Harbor CLI, allowing users to fetch and update system configurations via new CLI commands.
- Introduces conversion helpers for transforming API responses to configuration structs.
- Adds new utility functions for reading from and writing to the Harbor configuration file.
- Integrates "config get" and "config update" commands into the CLI command hierarchy.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/views/config/update/view.go | Adds a conversion function for configuration responses |
| pkg/utils/config.go | Adds utility functions for managing the Harbor configuration file |
| pkg/api/config_handler.go | Implements API handlers for getting and updating system configurations |
| cmd/harbor/root/config.go | Introduces new CLI commands for configuration management |
| cmd/harbor/root/cmd.go | Registers the new config command in the CLI |
|
|
||
| func AddConfigToConfigFile(config *models.ConfigurationsResponse, configPath string) error { | ||
| if _, err := os.Stat(configPath); os.IsNotExist(err) { | ||
| return err |
There was a problem hiding this comment.
Consider using the existing CreateConfigFile() utility to create the configuration file when it does not exist, rather than immediately returning an error.
| return err | |
| if err := CreateConfigFile(); err != nil { | |
| return err | |
| } |
|
@bupd @rizul2108, we need to rename the current/existing
|
|
The Harbor
harbor-cli config authentication ..
harbor-cli config security ..
harbor-cli config system .. |
|
@qcserestipy we could use your help here. Thanks |
|
@bupd I continued working on this branch in qcserestipy/rework-bupd-pr-114 and will open a draft PR within the next days. Do you think there is a good way how we can filter according to those three categories: as suggested by @Vad1mo. I would be happy about some ideas for filtering. One of my ideas was creating some categorization as a global var. Which I think is not optimal in case the api specification changes. // pkg/utils/config_categories.go
package utils
var ConfigurationCategories = map[string]string{
// Authentication
"AuthMode": "authentication",
"LdapBaseDn": "authentication",
"LdapFilter": "authentication",
"LdapSearchDn": "authentication",
"LdapSearchPassword": "authentication",
"LdapUID": "authentication",
"LdapURL": "authentication",
"OIDCClientID": "authentication",
"OIDCClientSecret": "authentication",
"OIDCEndpoint": "authentication",
"UaaClientID": "authentication",
"UaaClientSecret": "authentication",
"HTTPAuthproxyEndpoint": "authentication",
"PrimaryAuthMode": "authentication",
// Security
"LdapVerifyCert": "security",
"OIDCVerifyCert": "security",
"UaaVerifyCert": "security",
"HTTPAuthproxyVerifyCert": "security",
"SelfRegistration": "security",
"ProjectCreationRestriction": "security",
"RobotTokenDuration": "security",
"TokenExpiration": "security",
"SessionTimeout": "security",
// System
"ReadOnly": "system",
"QuotaPerProjectEnable": "system",
"StoragePerProject": "system",
"RobotNamePrefix": "system",
"NotificationEnable": "system",
"ScannerSkipUpdatePulltime": "system",
"SkipAuditLogDatabase": "system",
"AuditLogForwardEndpoint": "system",
"BannerMessage": "system",
} |
|
closing in favor of #521 |


Overview:
This pull request adds the config command, a vital enhancement for managing system configurations. The command is designed to fetch, update and store the system configuration in the Harbor config file, ensuring that the current configuration of the system is easily accessible and manageable.
Key Features:
Motivation and Context:
Managing system configurations is a fundamental task for system administrators. The current cli lacks the configuration management. By introducing the config command, we aim to streamline configuration management, making it easier for administrators to access and update system settings.
New Commands:
config get-- This command fetches and stores the system config in the harbor config file.config update-- This command updates the system config based on provided harbor config file.Fix: #94 #113 #438