mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-11-05 11:52:10 +08:00
feat: format openim config constran
This commit is contained in:
parent
7b262510f5
commit
1132bce252
@ -174,6 +174,11 @@ linters-settings:
|
|||||||
# - ^print.*$
|
# - ^print.*$
|
||||||
- 'fmt\.Print.*'
|
- 'fmt\.Print.*'
|
||||||
- fmt.Println.* # too much log noise
|
- fmt.Println.* # too much log noise
|
||||||
|
- ^unsafe\..*$
|
||||||
|
- ^init$
|
||||||
|
- ^os.Exit$
|
||||||
|
- ^fmt.Print.*$
|
||||||
|
- ^panic$
|
||||||
- painc
|
- painc
|
||||||
# - ginkgo\\.F.* # these are used just for local development
|
# - ginkgo\\.F.* # these are used just for local development
|
||||||
# # Exclude godoc examples from forbidigo checks. Default is true.
|
# # Exclude godoc examples from forbidigo checks. Default is true.
|
||||||
@ -239,9 +244,6 @@ linters-settings:
|
|||||||
hugeParam:
|
hugeParam:
|
||||||
# size in bytes that makes the warning trigger (default 80)
|
# size in bytes that makes the warning trigger (default 80)
|
||||||
sizeThreshold: 80
|
sizeThreshold: 80
|
||||||
nestingReduce:
|
|
||||||
# min number of statements inside a branch to trigger a warning (default 5)
|
|
||||||
bodyWidth: 5
|
|
||||||
rangeExprCopy:
|
rangeExprCopy:
|
||||||
# size in bytes that makes the warning trigger (default 512)
|
# size in bytes that makes the warning trigger (default 512)
|
||||||
sizeThreshold: 512
|
sizeThreshold: 512
|
||||||
@ -255,15 +257,10 @@ linters-settings:
|
|||||||
ruleguard:
|
ruleguard:
|
||||||
# path to a gorules file for the ruleguard checker
|
# path to a gorules file for the ruleguard checker
|
||||||
rules: ''
|
rules: ''
|
||||||
truncateCmp:
|
|
||||||
# whether to skip int/uint/uintptr types (default true)
|
|
||||||
skipArchDependent: true
|
|
||||||
underef:
|
underef:
|
||||||
# whether to skip (*x).method() calls where x is a pointer receiver (default true)
|
# whether to skip (*x).method() calls where x is a pointer receiver (default true)
|
||||||
skipRecvDeref: true
|
skipRecvDeref: true
|
||||||
unnamedResult:
|
|
||||||
# whether to check exported functions
|
|
||||||
checkExported: true
|
|
||||||
gocyclo:
|
gocyclo:
|
||||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||||
min-complexity: 30
|
min-complexity: 30
|
||||||
|
|||||||
@ -25,8 +25,6 @@ import (
|
|||||||
|
|
||||||
var Config GlobalConfig
|
var Config GlobalConfig
|
||||||
|
|
||||||
const ConfKey = "conf"
|
|
||||||
|
|
||||||
type CallBackConfig struct {
|
type CallBackConfig struct {
|
||||||
Enable bool `yaml:"enable"`
|
Enable bool `yaml:"enable"`
|
||||||
CallbackTimeOut int `yaml:"timeout"`
|
CallbackTimeOut int `yaml:"timeout"`
|
||||||
|
|||||||
23
pkg/common/config/constant.go
Normal file
23
pkg/common/config/constant.go
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package config
|
||||||
|
|
||||||
|
const ConfKey = "conf"
|
||||||
|
|
||||||
|
const (
|
||||||
|
// DefaultDirPerm is used for creating general directories, allowing the owner to read, write, and execute,
|
||||||
|
// while the group and others can only read and execute.
|
||||||
|
DefaultDirPerm = 0755
|
||||||
|
|
||||||
|
// PrivateFilePerm is used for sensitive files, allowing only the owner to read and write.
|
||||||
|
PrivateFilePerm = 0600
|
||||||
|
|
||||||
|
// ExecFilePerm is used for executable files, allowing the owner to read, write, and execute,
|
||||||
|
// while the group and others can only read.
|
||||||
|
ExecFilePerm = 0754
|
||||||
|
|
||||||
|
// SharedDirPerm is used for shared directories, allowing the owner and group to read, write, and execute,
|
||||||
|
// with no permissions for others.
|
||||||
|
SharedDirPerm = 0770
|
||||||
|
|
||||||
|
// ReadOnlyDirPerm is used for read-only directories, allowing the owner, group, and others to only read.
|
||||||
|
ReadOnlyDirPerm = 0555
|
||||||
|
)
|
||||||
@ -44,7 +44,7 @@ func Test_BatchInsertChat2DB(t *testing.T) {
|
|||||||
conf.RetainChatRecords = 3650
|
conf.RetainChatRecords = 3650
|
||||||
conf.ChatRecordsClearTime = "0 2 * * 3"
|
conf.ChatRecordsClearTime = "0 2 * * 3"
|
||||||
|
|
||||||
mongo, err := unrelation.NewMongo(conf)
|
mongo, err := unrelation.NewMongo(&conf.Mongo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -156,7 +156,7 @@ func GetDB() *commonMsgDatabase {
|
|||||||
conf.RetainChatRecords = 3650
|
conf.RetainChatRecords = 3650
|
||||||
conf.ChatRecordsClearTime = "0 2 * * 3"
|
conf.ChatRecordsClearTime = "0 2 * * 3"
|
||||||
|
|
||||||
mongo, err := unrelation.NewMongo(conf)
|
mongo, err := unrelation.NewMongo(&conf.Mongo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user