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

Support etcd auth(username and password) #1873

Open
1 task done
ahuigo opened this issue Jun 26, 2024 · 1 comment
Open
1 task done

Support etcd auth(username and password) #1873

ahuigo opened this issue Jun 26, 2024 · 1 comment
Labels
kind/enhancement New feature or request

Comments

@ahuigo
Copy link

ahuigo commented Jun 26, 2024

Preflight Checklist

  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Problem Description

Viper doesn't support etcd auth.

Proposed Solution

  1. Merge this PR: feat: Support ectd config(e.g., username and password) sagikazarmark/crypt#306
  2. In order to be compatible with the existing viper, how about putting the auth information in the endpoint? like this??
// old /remote/remote.go
case "etcd3":
    cm, err = crypt.NewStandardEtcdV3ConfigManager([]string{rp.Endpoint()})
// new
case "etcd3":
    var username,password string
    endpoint := rp.Endpoint() //"user:[email protected]:2379"
    eparts := strings.SplitN(endpoint, "@",2)
    if len(eparts) == 2{
        endpoint = eparts[1]
         userpass := strings.SplitN(eparts[0],":",2)
         username = userpass[0]
         password = userpass[1]
    }
    cm, err = crypt.NewStandardEtcdV3ConfigManagerRaw(goetcdv3.Config{
        Endpoints: []string(endpoint),
        Username: username,
        Password: password,
    })

Alternatives Considered

Add a new remote provider for etcd :

etcdConfig:= goetcdv3.Config{
    Endpoints: "127.0.0.1:2379"
    Username: "username",
    Password: "password",
}
viper.AddEtcd3RemoteProvider(etcdConfig, "/path")

Additional Information

No response

@ahuigo ahuigo added the kind/enhancement New feature or request label Jun 26, 2024
Copy link

👋 Thanks for reporting!

A maintainer will take a look at your issue shortly. 👀

In the meantime: We are working on Viper v2 and we would love to hear your thoughts about what you like or don't like about Viper, so we can improve or fix those issues.

⏰ If you have a couple minutes, please take some time and share your thoughts: https://forms.gle/R6faU74qPRPAzchZ9

📣 If you've already given us your feedback, you can still help by spreading the news,
either by sharing the above link or telling people about this on Twitter:

https://twitter.com/sagikazarmark/status/1306904078967074816

Thank you! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant