remove server and service in config

This commit is contained in:
Nam Huynh 2022-12-04 22:30:46 +07:00
parent 01c89a341c
commit 175d6f87c7
2 changed files with 4 additions and 13 deletions

View File

@ -24,12 +24,6 @@ type Config struct {
// Stream name // Stream name
StreamName string StreamName string
// Server
Server string
// Service
Service string
} }
func (c Config) validate() error { func (c Config) validate() error {
@ -37,10 +31,6 @@ func (c Config) validate() error {
return errors.New("connect URL is required") return errors.New("connect URL is required")
} }
if c.Server == "" || c.Service == "" {
return errors.New("server and service name is required")
}
return nil return nil
} }

View File

@ -29,7 +29,8 @@ func combineStreamAndSubjectName(stream, subject string) string {
return fmt.Sprintf("%s.%s", stream, subject) return fmt.Sprintf("%s.%s", stream, subject)
} }
// GenerateSubjectByClientType ... // GenerateSubject ...
func GenerateSubjectByClientType(subject string) string { // GenerateSubject("admin", "help_center", "get_ticket_by_id")
return fmt.Sprintf("%s.%s.%s.%s", globalConfig.StreamName, globalConfig.Server, globalConfig.Service, subject) func GenerateSubject(server, service, subject string) string {
return fmt.Sprintf("%s.%s.%s.%s", globalConfig.StreamName, server, service, subject)
} }