-
Notifications
You must be signed in to change notification settings - Fork 17
/
config.go
87 lines (69 loc) · 1.92 KB
/
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package config
import "github.com/spf13/viper"
var config *viper.Viper
func init() {
config = viper.New()
config.AutomaticEnv()
config.BindEnv("level", "LOG_LEVEL")
config.SetDefault("level", "debug")
config.BindEnv("endpoint", "S3_ENDPOINT")
config.BindEnv("accessKey", "S3_ACCESSKEYID")
config.BindEnv("secretkey", "S3_SECRETACCESSKEY")
config.BindEnv("bucket", "S3_BUCKET")
config.BindEnv("secure", "S3_SECURE")
config.BindEnv("registryUrl", "REGISTRY_URL")
config.BindEnv("repositoryName", "REPOSITORY_NAME")
config.BindEnv("userName", "USERNAME")
config.BindEnv("password", "PASSWORD")
config.BindEnv("mountPath", "MOUNT_PATH")
config.BindEnv("baseImage", "BASE_IMAGE")
config.BindEnv("llmUrl", "LLM_URL")
config.BindEnv("metricsExportAddress", "METRICS_EXPORT_ADDRESS")
config.BindEnv("storagePath", "STORAGE_PATH")
config.SetDefault("llmUrl", "/tmp/llama2-7b/")
}
func GetS3Endpoint() string {
return config.GetString("endpoint")
}
func GetS3AccesskeyId() string {
return config.GetString("accessKey")
}
func GetS3ESecretAccessKey() string {
return config.GetString("secretkey")
}
func GetS3Bucket() string {
return config.GetString("bucket")
}
func GetSecure() string {
return config.GetString("secure")
}
func GetLevel() string {
return config.GetString("level")
}
func GetUserName() string {
return config.GetString("userName")
}
func GetBaseImage() string {
return config.GetString("baseImage")
}
func GetPassword() string {
return config.GetString("password")
}
func GetRegistryUrl() string {
return config.GetString("registryUrl")
}
func GetRepositoryName() string {
return config.GetString("repositoryName")
}
func GetMountPath() string {
return config.GetString("mountPath")
}
func GetLLMUrl() string {
return config.GetString("llmUrl")
}
func GetStoragePath() string {
return config.GetString("storagePath")
}
func GetMetricsExportAddress() string {
return config.GetString("metricsExportAddress")
}