mirror of
https://github.com/komodorio/helm-dashboard.git
synced 2026-03-24 11:48:04 +00:00
Add username and password support to Repo add feature (#228)
* Add username and password support to Repo add in UI * Add support for Username and Passowrd in Add Repo API
This commit is contained in:
@@ -65,11 +65,15 @@ func (r *Repositories) List() ([]Repository, error) {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
func (r *Repositories) Add(name string, url string) error {
|
||||
func (r *Repositories) Add(name string, url string, username string, password string) error {
|
||||
if name == "" || url == "" {
|
||||
return errors.New("Name and URL are required parameters to add the repository")
|
||||
}
|
||||
|
||||
if (username != "" && password == "") || (username == "" && password != "") {
|
||||
return errors.New("Username and Password, both are required parameters to add the repository with authentication")
|
||||
}
|
||||
|
||||
// copied from cmd/helm/repo_add.go
|
||||
repoFile := r.Settings.RepositoryConfig
|
||||
|
||||
@@ -88,10 +92,10 @@ func (r *Repositories) Add(name string, url string) error {
|
||||
defer r.mx.Unlock()
|
||||
|
||||
c := repo.Entry{
|
||||
Name: name,
|
||||
URL: url,
|
||||
//Username: o.username,
|
||||
//Password: o.password,
|
||||
Name: name,
|
||||
URL: url,
|
||||
Username: username,
|
||||
Password: password,
|
||||
//PassCredentialsAll: o.passCredentialsAll,
|
||||
//CertFile: o.certFile,
|
||||
//KeyFile: o.keyFile,
|
||||
|
||||
Reference in New Issue
Block a user