func main() {
users := map[string]string{
"admin": "fCRmh4Q2J7Rseqkz",
"packt": "RE4zfHB35VPtTkbT",
"mlabouardy": "L3nSFRcZzNQ67bcc",
}
ctx := context.Background()
client, err := mongo.Connect(ctx,
options.Client().ApplyURI(os.Getenv("MONGO_URI")))
if err = client.Ping(context.TODO(),
readpref.Primary()); err != nil {
log.Fatal(err)
}
collection := client.Database(os.Getenv(
"MONGO_DATABASE")).Collection("users")
h := sha256.New()
for username, password := range users {
collection.InsertOne(ctx, bson.M{
"username": username,
"password": string(h.Sum([]byte(password))),
})
}
}-
Notifications
You must be signed in to change notification settings - Fork 0
tuxnotes/recipes-api
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
About
No description, website, or topics provided.
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published