Dragonfly2
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
17package config
18
19import (
20"net"
21"time"
22
23"d7y.io/dragonfly/v2/pkg/net/ip"
24)
25
26const (
27// DatabaseTypeMysql is database type of mysql.
28DatabaseTypeMysql = "mysql"
29
30// DatabaseTypeMariaDB is database type of mariadb.
31DatabaseTypeMariaDB = "mariadb"
32
33// DatabaseTypePostgres is database type of postgres.
34DatabaseTypePostgres = "postgres"
35)
36
37const (
38// DefaultServerName is default server name.
39DefaultServerName = "d7y/manager"
40
41// DefaultGRPCPort is default port for grpc server.
42DefaultGRPCPort = 65003
43
44// DefaultRESTAddr is default address for rest server.
45DefaultRESTAddr = ":8080"
46)
47
48const (
49// DefaultJWTTimeout is default of name in jwt.
50DefaultJWTRealm = "Dragonfly"
51
52// DefaultJWTTimeout is default of timeout in jwt.
53DefaultJWTTimeout = 2 * 24 * time.Hour
54
55// DefaultJWTMaxRefresh is default of max refresh in jwt.
56DefaultJWTMaxRefresh = 2 * 24 * time.Hour
57)
58
59const (
60// DefaultRedisDB is default db for redis.
61DefaultRedisDB = 0
62
63// DefaultRedisBrokerDB is default db for redis broker.
64DefaultRedisBrokerDB = 1
65
66// DefaultRedisBackendDB is default db for redis backend.
67DefaultRedisBackendDB = 2
68)
69
70const (
71// DefaultRedisCacheTTL is default ttl for redis cache.
72DefaultRedisCacheTTL = 5 * time.Minute
73
74// DefaultLFUCacheTTL is default ttl for lfu cache.
75DefaultLFUCacheTTL = 3 * time.Minute
76
77// DefaultLFUCacheSize is default size for lfu cache.
78DefaultLFUCacheSize = 100 * 1000
79)
80
81const (
82// DefaultMysqlPort is default port for mysql.
83DefaultMysqlPort = 3306
84
85// DefaultMysqlDBName is default db name for mysql.
86DefaultMysqlDBName = "manager"
87)
88
89const (
90// DefaultJobPreheatRegistryTimeout is the default timeout for requesting registry to get token and manifest.
91DefaultJobPreheatRegistryTimeout = 1 * time.Minute
92
93// DefaultJobSyncPeersInterval is the default interval for syncing all peers information from the scheduler.
94DefaultJobSyncPeersInterval = 24 * time.Hour
95
96// MinJobSyncPeersInterval is the min interval for syncing all peers information from the scheduler.
97MinJobSyncPeersInterval = 12 * time.Hour
98
99// DefaultJobSyncPeersTimeout is the default timeout for syncing all peers information from the scheduler.
100DefaultJobSyncPeersTimeout = 10 * time.Minute
101)
102
103const (
104// DefaultPostgresPort is default port for postgres.
105DefaultPostgresPort = 5432
106
107// DefaultPostgresDBName is default db name for postgres.
108DefaultPostgresDBName = "manager"
109
110// DefaultPostgresSSLMode is default ssl mode for postgres.
111DefaultPostgresSSLMode = "disable"
112
113// DefaultPostgresPreferSimpleProtocol is default disable prepared statement option for postgres.
114DefaultPostgresPreferSimpleProtocol = false
115
116// DefaultPostgresTimezone is default timezone for postgres.
117DefaultPostgresTimezone = "UTC"
118)
119
120const (
121// DefaultMetricsAddr is default address for metrics server.
122DefaultMetricsAddr = ":8000"
123)
124
125var (
126// DefaultCertIPAddresses is default ip addresses of certificate.
127DefaultCertIPAddresses = []net.IP{ip.IPv4, ip.IPv6}
128
129// DefaultCertDNSNames is default dns names of certificate.
130DefaultCertDNSNames = []string{"dragonfly-manager", "dragonfly-manager.dragonfly-system.svc", "dragonfly-manager.dragonfly-system.svc.cluster.local"}
131
132// DefaultCertValidityPeriod is default validity period of certificate.
133DefaultCertValidityPeriod = 10 * 365 * 24 * time.Hour
134)
135
136var (
137// DefaultNetworkEnableIPv6 is default value of enableIPv6.
138DefaultNetworkEnableIPv6 = false
139)
140
141var (
142// DefaultTrainerBucketName is default object storage bucket name of model.
143DefaultTrainerBucketName = "models"
144)
145