Dragonfly2

Форк
0
/
constants.go 
144 строки · 4.1 Кб
1
/*
2
 *     Copyright 2022 The Dragonfly Authors
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *      http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package config
18

19
import (
20
	"net"
21
	"time"
22

23
	"d7y.io/dragonfly/v2/pkg/net/ip"
24
)
25

26
const (
27
	// DatabaseTypeMysql is database type of mysql.
28
	DatabaseTypeMysql = "mysql"
29

30
	// DatabaseTypeMariaDB is database type of mariadb.
31
	DatabaseTypeMariaDB = "mariadb"
32

33
	// DatabaseTypePostgres is database type of postgres.
34
	DatabaseTypePostgres = "postgres"
35
)
36

37
const (
38
	// DefaultServerName is default server name.
39
	DefaultServerName = "d7y/manager"
40

41
	// DefaultGRPCPort is default port for grpc server.
42
	DefaultGRPCPort = 65003
43

44
	// DefaultRESTAddr is default address for rest server.
45
	DefaultRESTAddr = ":8080"
46
)
47

48
const (
49
	// DefaultJWTTimeout is default of name in jwt.
50
	DefaultJWTRealm = "Dragonfly"
51

52
	// DefaultJWTTimeout is default of timeout in jwt.
53
	DefaultJWTTimeout = 2 * 24 * time.Hour
54

55
	// DefaultJWTMaxRefresh is default of max refresh in jwt.
56
	DefaultJWTMaxRefresh = 2 * 24 * time.Hour
57
)
58

59
const (
60
	// DefaultRedisDB is default db for redis.
61
	DefaultRedisDB = 0
62

63
	// DefaultRedisBrokerDB is default db for redis broker.
64
	DefaultRedisBrokerDB = 1
65

66
	// DefaultRedisBackendDB is default db for redis backend.
67
	DefaultRedisBackendDB = 2
68
)
69

70
const (
71
	// DefaultRedisCacheTTL is default ttl for redis cache.
72
	DefaultRedisCacheTTL = 5 * time.Minute
73

74
	// DefaultLFUCacheTTL is default ttl for lfu cache.
75
	DefaultLFUCacheTTL = 3 * time.Minute
76

77
	// DefaultLFUCacheSize is default size for lfu cache.
78
	DefaultLFUCacheSize = 100 * 1000
79
)
80

81
const (
82
	// DefaultMysqlPort is default port for mysql.
83
	DefaultMysqlPort = 3306
84

85
	// DefaultMysqlDBName is default db name for mysql.
86
	DefaultMysqlDBName = "manager"
87
)
88

89
const (
90
	// DefaultJobPreheatRegistryTimeout is the default timeout for requesting registry to get token and manifest.
91
	DefaultJobPreheatRegistryTimeout = 1 * time.Minute
92

93
	// DefaultJobSyncPeersInterval is the default interval for syncing all peers information from the scheduler.
94
	DefaultJobSyncPeersInterval = 24 * time.Hour
95

96
	// MinJobSyncPeersInterval is the min interval for syncing all peers information from the scheduler.
97
	MinJobSyncPeersInterval = 12 * time.Hour
98

99
	// DefaultJobSyncPeersTimeout is the default timeout for syncing all peers information from the scheduler.
100
	DefaultJobSyncPeersTimeout = 10 * time.Minute
101
)
102

103
const (
104
	// DefaultPostgresPort is default port for postgres.
105
	DefaultPostgresPort = 5432
106

107
	// DefaultPostgresDBName is default db name for postgres.
108
	DefaultPostgresDBName = "manager"
109

110
	// DefaultPostgresSSLMode is default ssl mode for postgres.
111
	DefaultPostgresSSLMode = "disable"
112

113
	// DefaultPostgresPreferSimpleProtocol is default disable prepared statement option for postgres.
114
	DefaultPostgresPreferSimpleProtocol = false
115

116
	// DefaultPostgresTimezone is default timezone for postgres.
117
	DefaultPostgresTimezone = "UTC"
118
)
119

120
const (
121
	// DefaultMetricsAddr is default address for metrics server.
122
	DefaultMetricsAddr = ":8000"
123
)
124

125
var (
126
	// DefaultCertIPAddresses is default ip addresses of certificate.
127
	DefaultCertIPAddresses = []net.IP{ip.IPv4, ip.IPv6}
128

129
	// DefaultCertDNSNames is default dns names of certificate.
130
	DefaultCertDNSNames = []string{"dragonfly-manager", "dragonfly-manager.dragonfly-system.svc", "dragonfly-manager.dragonfly-system.svc.cluster.local"}
131

132
	// DefaultCertValidityPeriod is default validity period of certificate.
133
	DefaultCertValidityPeriod = 10 * 365 * 24 * time.Hour
134
)
135

136
var (
137
	// DefaultNetworkEnableIPv6 is default value of enableIPv6.
138
	DefaultNetworkEnableIPv6 = false
139
)
140

141
var (
142
	// DefaultTrainerBucketName is default object storage bucket name of model.
143
	DefaultTrainerBucketName = "models"
144
)
145

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.