mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-07 06:53:09 -06:00
add option for credentials file for NATS; more info: https://docs.nats.io/using-nats/developer/connecting/creds
This commit is contained in:
parent
7a4ef240fc
commit
a2d2ee106a
|
|
@ -21,6 +21,9 @@ type JetStream struct {
|
||||||
NoLog bool `yaml:"-"`
|
NoLog bool `yaml:"-"`
|
||||||
// Disables TLS validation. This should NOT be used in production
|
// Disables TLS validation. This should NOT be used in production
|
||||||
DisableTLSValidation bool `yaml:"disable_tls_validation"`
|
DisableTLSValidation bool `yaml:"disable_tls_validation"`
|
||||||
|
// A credentials file to be used for authentication, example:
|
||||||
|
// https://docs.nats.io/using-nats/developer/connecting/creds
|
||||||
|
Credentials Path `yaml:"credentials_path"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *JetStream) Prefixed(name string) string {
|
func (c *JetStream) Prefixed(name string) string {
|
||||||
|
|
@ -38,6 +41,7 @@ func (c *JetStream) Defaults(opts DefaultOpts) {
|
||||||
c.StoragePath = Path("./")
|
c.StoragePath = Path("./")
|
||||||
c.NoLog = true
|
c.NoLog = true
|
||||||
c.DisableTLSValidation = true
|
c.DisableTLSValidation = true
|
||||||
|
c.Credentials = Path("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,9 @@ func setupNATS(process *process.ProcessContext, cfg *config.JetStream, nc *natsc
|
||||||
InsecureSkipVerify: true,
|
InsecureSkipVerify: true,
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
if string(cfg.Credentials) != "" {
|
||||||
|
opts = append(opts, natsclient.UserCredentials(string(cfg.Credentials)))
|
||||||
|
}
|
||||||
nc, err = natsclient.Connect(strings.Join(cfg.Addresses, ","), opts...)
|
nc, err = natsclient.Connect(strings.Join(cfg.Addresses, ","), opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logrus.WithError(err).Panic("Unable to connect to NATS")
|
logrus.WithError(err).Panic("Unable to connect to NATS")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue