remove server and service in config
This commit is contained in:
parent
01c89a341c
commit
175d6f87c7
10
config.go
10
config.go
|
@ -24,12 +24,6 @@ type Config struct {
|
|||
|
||||
// Stream name
|
||||
StreamName string
|
||||
|
||||
// Server
|
||||
Server string
|
||||
|
||||
// Service
|
||||
Service string
|
||||
}
|
||||
|
||||
func (c Config) validate() error {
|
||||
|
@ -37,10 +31,6 @@ func (c Config) validate() error {
|
|||
return errors.New("connect URL is required")
|
||||
}
|
||||
|
||||
if c.Server == "" || c.Service == "" {
|
||||
return errors.New("server and service name is required")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
7
utils.go
7
utils.go
|
@ -29,7 +29,8 @@ func combineStreamAndSubjectName(stream, subject string) string {
|
|||
return fmt.Sprintf("%s.%s", stream, subject)
|
||||
}
|
||||
|
||||
// GenerateSubjectByClientType ...
|
||||
func GenerateSubjectByClientType(subject string) string {
|
||||
return fmt.Sprintf("%s.%s.%s.%s", globalConfig.StreamName, globalConfig.Server, globalConfig.Service, subject)
|
||||
// GenerateSubject ...
|
||||
// GenerateSubject("admin", "help_center", "get_ticket_by_id")
|
||||
func GenerateSubject(server, service, subject string) string {
|
||||
return fmt.Sprintf("%s.%s.%s.%s", globalConfig.StreamName, server, service, subject)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue