Skip to content

Commit 6dcd3f2

Browse files
committed
域名服务集群创建时可以选择开启访问日志
1 parent 7936dc8 commit 6dcd3f2

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

internal/db/models/nameservers/ns_cluster_dao.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,14 @@ func (this *NSClusterDAO) FindEnabledNSClusterName(tx *dbs.Tx, id int64) (string
7373
}
7474

7575
// CreateCluster 创建集群
76-
func (this *NSClusterDAO) CreateCluster(tx *dbs.Tx, name string) (int64, error) {
76+
func (this *NSClusterDAO) CreateCluster(tx *dbs.Tx, name string, accessLogRefJSON []byte) (int64, error) {
7777
op := NewNSClusterOperator()
7878
op.Name = name
79+
80+
if len(accessLogRefJSON) > 0 {
81+
op.AccessLog = accessLogRefJSON
82+
}
83+
7984
op.IsOn = true
8085
op.State = NSClusterStateEnabled
8186
return this.SaveInt64(tx, op)

internal/rpc/services/nameservers/service_ns_cluster.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func (this *NSClusterService) CreateNSCluster(ctx context.Context, req *pb.Creat
2121
return nil, err
2222
}
2323
var tx = this.NullTx()
24-
clusterId, err := nameservers.SharedNSClusterDAO.CreateCluster(tx, req.Name)
24+
clusterId, err := nameservers.SharedNSClusterDAO.CreateCluster(tx, req.Name, req.AccessLogJSON)
2525
if err != nil {
2626
return nil, err
2727
}

0 commit comments

Comments
 (0)