/
global-config.go
29 lines (23 loc) · 1017 Bytes
/
global-config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package db
import (
"context"
"go.mongodb.org/mongo-driver/bson/primitive"
"go.mongodb.org/mongo-driver/mongo"
"github.com/nam-truong-le/lambda-utils-go/v3/pkg/aws/ssm"
"github.com/nam-truong-le/lambda-utils-go/v3/pkg/mongodb"
)
const colGlobalConfig = "globalconfigs"
func CollectionGlobalConfig(ctx context.Context) (*mongo.Collection, error) {
database, err := ssm.GetParameter(ctx, "/mongo/database", false)
if err != nil {
return nil, err
}
return mongodb.Collection(ctx, database, colGlobalConfig)
}
type GlobalConfig struct {
ID primitive.ObjectID `bson:"_id" json:"id"`
ProductAttributeOutOfStockIn int `bson:"productAttributeOutOfStockInId" json:"productAttributeOutOfStockInId"`
ProductAttributePfandId int `bson:"productAttributePfandId" json:"productAttributePfandId"`
PusherAPIKey string `json:"pusherApiKey"`
DeliverectWebhookSecret string `json:"deliverectWebhookSecret"`
}