Skip to content

Commit 66cf43d

Browse files
committed
hide my password
1 parent faf225c commit 66cf43d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
cridentials.go

elasticsearch_client.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33
import (
44
"context"
55
"fmt"
6-
76
"github.com/olivere/elastic"
87
)
98

@@ -16,7 +15,7 @@ func readFromES(query elastic.Query, index string) (*elastic.SearchResult, error
1615
fmt.Println("step into readFromES")
1716
client, err := elastic.NewClient(
1817
elastic.SetURL(ES_URL),
19-
elastic.SetBasicAuth("elastic", "MatrixMayaowei123"))
18+
elastic.SetBasicAuth("elastic", DATABASE_PASSWORD))
2019
if err != nil {
2120
fmt.Println("client creation error")
2221
return nil, err
@@ -40,7 +39,7 @@ func saveToES(i interface{}, index string, id string) error {
4039
// 1. 建立连接
4140
client, err := elastic.NewClient(
4241
elastic.SetURL(ES_URL),
43-
elastic.SetBasicAuth("elastic", "MatrixMayaowei123"))
42+
elastic.SetBasicAuth("elastic", DATABASE_PASSWORD))
4443
if err != nil {
4544
return err
4645
}

handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ var (
2626
}
2727
)
2828

29-
var mySigningKey = []byte("This is my key value!") // symmetric encryption key
29+
var mySigningKey = []byte(JWT_KEY) // symmetric encryption key
3030

3131
// func uploadHandler(w http.ResponseWriter, r *http.Request) {
3232
// // w是writer, r是request, 后者是pointer可以对Request本身操作。
@@ -223,4 +223,4 @@ func signupHandler(w http.ResponseWriter, r *http.Request) {
223223
return
224224
}
225225
fmt.Printf("User added successfully: %s.\n", user.Username)
226-
}
226+
}

0 commit comments

Comments
 (0)