Skip to content

Commit

Permalink
Modify dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
alallema authored and brunoocasali committed Jul 28, 2022
1 parent 3204cfc commit 1268664
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ You can set up your local environment natively or using `docker`, check out the

Example of running all the checks with docker:
```bash
docker-compose run --rm package bash -c "golangci-lint run -v && go test -v ./..."
docker-compose run --rm package bash -c "golangci-lint run -v && go test -v"
```

To install dependencies:
Expand Down
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ COPY go.sum .

COPY --from=golangci/golangci-lint:v1.42.0 /usr/bin/golangci-lint /usr/local/bin/golangci-lint

RUN go clean -cache
RUN go mod download
RUN go mod verify
4 changes: 2 additions & 2 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ func TestClient_GenerateTenantToken(t *testing.T) {
args: args{
IndexUID: "TestGenerateTenantTokenWithoutApiKey",
client: NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: "",
}),
APIKeyUID: GetPrivateUIDKey(),
Expand Down Expand Up @@ -1173,7 +1173,7 @@ func TestClient_GenerateTenantToken(t *testing.T) {
}

client := NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: token,
})

Expand Down
22 changes: 11 additions & 11 deletions main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ type docTestBooks struct {
Year int `json:"year"`
}

func getMeilisearchHost() string {
value := os.Getenv("MEILISEARCH_HOST")
func getenv(key, fallback string) string {
value := os.Getenv(key)
if len(value) == 0 {
return "http://localhost:7700"
return fallback
}
return value
}
Expand Down Expand Up @@ -113,7 +113,7 @@ func GetPrivateUIDKey() (key string) {

func SetUpEmptyIndex(index *IndexConfig) (resp *Index, err error) {
client := NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: masterKey,
})
task, err := client.CreateIndex(index)
Expand All @@ -130,7 +130,7 @@ func SetUpEmptyIndex(index *IndexConfig) (resp *Index, err error) {

func SetUpBasicIndex(indexUID string) {
client := NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: masterKey,
})
index := client.Index(indexUID)
Expand All @@ -156,7 +156,7 @@ func SetUpBasicIndex(indexUID string) {

func SetUpIndexWithNestedFields(indexUID string) {
client := NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: masterKey,
})
index := client.Index(indexUID)
Expand All @@ -183,7 +183,7 @@ func SetUpIndexWithNestedFields(indexUID string) {

func SetUpIndexForFaceting() {
client := NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: masterKey,
})
index := client.Index("indexUID")
Expand Down Expand Up @@ -224,7 +224,7 @@ func SetUpIndexForFaceting() {
var (
masterKey = "masterKey"
defaultClient = NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: masterKey,
})
defaultRankingRules = []string{
Expand All @@ -248,7 +248,7 @@ var (
)

var customClient = NewFastHTTPCustomClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: masterKey,
},
&fasthttp.Client{
Expand All @@ -257,13 +257,13 @@ var customClient = NewFastHTTPCustomClient(ClientConfig{
})

var timeoutClient = NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: masterKey,
Timeout: 1,
})

var privateClient = NewClient(ClientConfig{
Host: getMeilisearchHost(),
Host: getenv("MEILISEARCH_HOST", "http://localhost:7700"),
APIKey: GetPrivateKey(),
})

Expand Down

0 comments on commit 1268664

Please sign in to comment.