updated 'config.ini'
This commit is contained in:
parent
28f71271d7
commit
be4f86580e
13 changed files with 635 additions and 208 deletions
55
init.go
55
init.go
|
@ -3,37 +3,8 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Port int
|
||||
AuthCode string
|
||||
PeerID string
|
||||
Peers []string
|
||||
Domain string
|
||||
NodesEnabled bool
|
||||
CrawlerEnabled bool
|
||||
WebsiteEnabled bool
|
||||
LogLevel int
|
||||
HardCacheDuration time.Duration
|
||||
HardCacheEnabled bool
|
||||
}
|
||||
|
||||
var defaultConfig = Config{
|
||||
Port: 5000,
|
||||
Domain: "localhost",
|
||||
Peers: []string{},
|
||||
AuthCode: generateStrongRandomString(64),
|
||||
NodesEnabled: true,
|
||||
CrawlerEnabled: true,
|
||||
WebsiteEnabled: true,
|
||||
LogLevel: 1,
|
||||
HardCacheDuration: 0,
|
||||
}
|
||||
|
||||
const configFilePath = "config.ini"
|
||||
|
||||
var config Config
|
||||
|
||||
func main() {
|
||||
|
@ -60,7 +31,7 @@ func main() {
|
|||
// Initialize configuration interactively or from config file
|
||||
err := initConfig()
|
||||
if err != nil {
|
||||
printErr("Error during initialization:")
|
||||
printErr("Error during initialization: %v", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +62,29 @@ func main() {
|
|||
InitializeLanguage("en") // Initialize language before generating OpenSearch
|
||||
generateOpenSearchXML(config)
|
||||
|
||||
go startNodeClient()
|
||||
// Start the node client only if NodesEnabled is true
|
||||
if config.NodesEnabled {
|
||||
go startNodeClient()
|
||||
printInfo("Node client started.")
|
||||
} else {
|
||||
printInfo("Node client is disabled.")
|
||||
}
|
||||
|
||||
// Start periodic cleanup of expired cache files
|
||||
if config.DriveCacheEnabled {
|
||||
go cleanExpiredCachedImages()
|
||||
printInfo("Drive cache started.")
|
||||
} else {
|
||||
printInfo("Drive cache is disabled.")
|
||||
}
|
||||
|
||||
// Start periodic cleanup of expired cache files
|
||||
if config.RamCacheEnabled {
|
||||
resultsCache = NewResultsCache()
|
||||
printInfo("RAM cache started.")
|
||||
} else {
|
||||
printInfo("RAM cache is disabled.")
|
||||
}
|
||||
|
||||
runServer()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue