mirror of
https://github.com/MedzikUser/go-pingbot
synced 2024-08-14 23:57:07 +00:00
perf(config): remove mongodb db and collection from .env
BREAKING CHANGE: mongodb database and collection ISN'T LONGER IN ENV MUST BE IN config.toml, and RENAME MONGODB_URI to MONGO_URI IN .env. Deleted node in config.
This commit is contained in:
parent
5dd2c129cb
commit
614054e446
5 changed files with 3 additions and 19 deletions
|
@ -10,10 +10,6 @@ ping=3 # Ping every three minutes
|
||||||
enabled=true # Enable Auto Updater
|
enabled=true # Enable Auto Updater
|
||||||
check=2 # Check every two minutes
|
check=2 # Check every two minutes
|
||||||
|
|
||||||
[cluster]
|
|
||||||
id=1 # Cluster ID
|
|
||||||
node=1 # Node ID
|
|
||||||
|
|
||||||
[mongodb]
|
[mongodb]
|
||||||
database="PingBot" # MongoDB Database Name
|
database="PingBot" # MongoDB Database Name
|
||||||
collection="URL" # MongoDB Collection Name
|
collection="URL" # MongoDB Collection Name
|
||||||
|
|
|
@ -8,9 +8,7 @@ import (
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// mongo
|
// mongo
|
||||||
Mongo_URI = os.Getenv("MONGODB_URI")
|
Mongo_URI = os.Getenv("MONGO_URI")
|
||||||
Mongo_DB = os.Getenv("MONGODB_DB")
|
|
||||||
Mongo_Collection = os.Getenv("MONGODB_COLLECTION")
|
|
||||||
|
|
||||||
// github
|
// github
|
||||||
GH_Token = os.Getenv("GH_TOKEN")
|
GH_Token = os.Getenv("GH_TOKEN")
|
||||||
|
|
|
@ -35,8 +35,7 @@ type autoUpdateConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type clusterConfig struct {
|
type clusterConfig struct {
|
||||||
ID int
|
ID int
|
||||||
Node int
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type mongoDBConfig struct {
|
type mongoDBConfig struct {
|
||||||
|
@ -65,14 +64,6 @@ func init() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if Toml.MongoDB.Collection != "" {
|
|
||||||
Mongo_Collection = Toml.MongoDB.Collection
|
|
||||||
}
|
|
||||||
|
|
||||||
if Toml.MongoDB.Database != "" {
|
|
||||||
Mongo_DB = Toml.MongoDB.Database
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func DownloadFile(filepath string, url string) error {
|
func DownloadFile(filepath string, url string) error {
|
||||||
|
|
|
@ -33,7 +33,7 @@ func Connect() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
Coll = Client.Database(config.Mongo_DB).Collection(config.Mongo_Collection)
|
Coll = Client.Database(config.Toml.MongoDB.Database).Collection(config.Toml.MongoDB.Collection)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
@ -55,7 +55,6 @@ func Status(c *gin.Context) {
|
||||||
},
|
},
|
||||||
"node": json{
|
"node": json{
|
||||||
"cluster": config.Toml.Cluster.ID,
|
"cluster": config.Toml.Cluster.ID,
|
||||||
"node": config.Toml.Cluster.Node,
|
|
||||||
"uptime": common.Uptime(config.StartTime),
|
"uptime": common.Uptime(config.StartTime),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue