Skip to content

Commit

Permalink
make correrlationid function private
Browse files Browse the repository at this point in the history
  • Loading branch information
t0mk committed Nov 16, 2023
1 parent 36a8da0 commit d7b3fa0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (c *Config) NewFabricClient() *v4.APIClient {
authClient.Timeout = c.requestTimeout()
fabricHeaderMap := map[string]string{
"X-SOURCE": "API",
"X-CORRELATION-ID": CorrelationId(25),
"X-CORRELATION-ID": correlationId(25),
}
v4Configuration := v4.Configuration{
BasePath: c.BaseURL,
Expand Down
6 changes: 3 additions & 3 deletions internal/config/correlation_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ const allowed_charset = "abcdefghijklmnopqrstuvwxyz" +
var seededRand = rand.New(
rand.NewSource(time.Now().UnixNano()))

func CorrelationIdWithCharset(length int, charset string) string {
func correlationIdWithCharset(length int, charset string) string {
b := make([]byte, length)
for i := range b {
b[i] = charset[seededRand.Intn(len(charset))]
}
return string(b)
}

func CorrelationId(length int) string {
return CorrelationIdWithCharset(length, allowed_charset)
func correlationId(length int) string {
return correlationIdWithCharset(length, allowed_charset)
}

0 comments on commit d7b3fa0

Please sign in to comment.