Skip to content

Commit

Permalink
refactor: rename clientId to customerName in NewCompress and update r…
Browse files Browse the repository at this point in the history
…elated logic
  • Loading branch information
allan committed Jan 23, 2025
1 parent 2bc0dac commit 40935c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions compress/compress.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package compress

import (
"fmt"
"strings"

"github.com/go-resty/resty/v2"
"github.com/minio/minio-go"
Expand Down Expand Up @@ -44,14 +43,15 @@ type compress struct {
customerId int
}

func NewCompress(clientId, apiKey string, isDebug bool) (ICompress, error) {
if clientId == "" {
func NewCompress(customerName, apiKey string, isDebug bool) (ICompress, error) {
if customerName == "" {
return nil, fmt.Errorf("clientId is compulsory")
}
if apiKey == "" {
return nil, fmt.Errorf("apiKey is compulsory")
}
customerName := strings.ReplaceAll(clientId, "_client", "")
//customerName := strings.ReplaceAll(clientId, "_client", "")
clientId := customerName + "_client"
c := &compress{
debug: isDebug,
restClient: resty.New(),
Expand Down
8 changes: 4 additions & 4 deletions test/a_main_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package test

import (
"log"
"os"
"testing"

Expand Down Expand Up @@ -30,12 +29,13 @@ func TestNewCompress(t *testing.T) {

func GetCompress() (compress.ICompress, error) {
apiKey := os.Getenv("API_KEY")
clientId := os.Getenv("CLIENT_ID")
//clientId := os.Getenv("CLIENT_ID")
customerName := os.Getenv("CUSTOMER_NAME")
//
c, err := compress.NewCompress(clientId, apiKey, false)
c, err := compress.NewCompress(customerName, apiKey, false)
if err != nil {
return nil, err
}
log.Println("compress", c)
//log.Println("compress", c)
return c, nil
}

0 comments on commit 40935c5

Please sign in to comment.