update
This commit is contained in:
parent
95d134c2ec
commit
368afccb7f
18
config.yml
18
config.yml
@ -3,16 +3,18 @@ robotfs:
|
|||||||
log_path: "/var/log/robotfs"
|
log_path: "/var/log/robotfs"
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
address: "localhost:6379"
|
address: "180.76.110.177:6379"
|
||||||
password: ""
|
username: "default"
|
||||||
db: 0
|
password: "uRC0EKTFm*4"
|
||||||
|
database: 0
|
||||||
|
# superLargeDirectories: []
|
||||||
|
|
||||||
s3:
|
s3:
|
||||||
region: "us-east-1"
|
region: "default"
|
||||||
endpoint: "http://localhost:9000"
|
endpoint: "http://120.48.66.228:6202"
|
||||||
access_key_id: "minioadmin"
|
access_key_id: "admin"
|
||||||
secret_access_key: "minioadmin"
|
secret_access_key: "admin"
|
||||||
bucket_name: "robotfs"
|
bucket_name: "myjfs"
|
||||||
use_path_style: true
|
use_path_style: true
|
||||||
|
|
||||||
juicefs:
|
juicefs:
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package config
|
package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"robotfs/utils"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gosvc"
|
"gosvc"
|
||||||
@ -8,6 +9,10 @@ import (
|
|||||||
"gosvc/logger"
|
"gosvc/logger"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
cfg = utils.GetViper()
|
||||||
|
)
|
||||||
|
|
||||||
func SetupServiceConfig() {
|
func SetupServiceConfig() {
|
||||||
gosvc.Config = gosvc.ServiceConfig{
|
gosvc.Config = gosvc.ServiceConfig{
|
||||||
Name: "robotfs",
|
Name: "robotfs",
|
||||||
@ -17,7 +22,7 @@ func SetupServiceConfig() {
|
|||||||
},
|
},
|
||||||
Logger: gosvc.LoggerConfig{
|
Logger: gosvc.LoggerConfig{
|
||||||
Options: logger.Options{
|
Options: logger.Options{
|
||||||
TargetDirectory: "/var/log/robotfs",
|
TargetDirectory: cfg.GetString("robotfs.log_path"),
|
||||||
FilePrefix: "robotfs",
|
FilePrefix: "robotfs",
|
||||||
CycleFiles: 16,
|
CycleFiles: 16,
|
||||||
MaxFileSize: 64 * 1024 * 1024,
|
MaxFileSize: 64 * 1024 * 1024,
|
||||||
@ -37,7 +42,7 @@ func SetupServiceConfig() {
|
|||||||
HTTPServer: gosvc.HTTPServerConfig{
|
HTTPServer: gosvc.HTTPServerConfig{
|
||||||
Enable: true,
|
Enable: true,
|
||||||
Options: httpserver.Options{
|
Options: httpserver.Options{
|
||||||
Address: "0.0.0.0:6201",
|
Address: cfg.GetString("robotfs.address"),
|
||||||
TLSEnabled: false,
|
TLSEnabled: false,
|
||||||
CrossOriginEnabled: true,
|
CrossOriginEnabled: true,
|
||||||
MaxConcurrentStreams: 10000,
|
MaxConcurrentStreams: 10000,
|
||||||
|
|||||||
@ -21,15 +21,17 @@ func (store *RedisLuaStore) GetName() string {
|
|||||||
func (store *RedisLuaStore) Initialize(configuration utils.Configuration, prefix string) (err error) {
|
func (store *RedisLuaStore) Initialize(configuration utils.Configuration, prefix string) (err error) {
|
||||||
return store.initialize(
|
return store.initialize(
|
||||||
configuration.GetString(prefix+"address"),
|
configuration.GetString(prefix+"address"),
|
||||||
|
configuration.GetString(prefix+"username"),
|
||||||
configuration.GetString(prefix+"password"),
|
configuration.GetString(prefix+"password"),
|
||||||
configuration.GetInt(prefix+"database"),
|
configuration.GetInt(prefix+"database"),
|
||||||
configuration.GetStringSlice(prefix+"superLargeDirectories"),
|
configuration.GetStringSlice(prefix+"superLargeDirectories"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (store *RedisLuaStore) initialize(hostPort string, password string, database int, superLargeDirectories []string) (err error) {
|
func (store *RedisLuaStore) initialize(hostPort string, username, password string, database int, superLargeDirectories []string) (err error) {
|
||||||
store.Client = redis.NewClient(&redis.Options{
|
store.Client = redis.NewClient(&redis.Options{
|
||||||
Addr: hostPort,
|
Addr: hostPort,
|
||||||
|
Username: username,
|
||||||
Password: password,
|
Password: password,
|
||||||
DB: database,
|
DB: database,
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user