mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* Add windows to the CI * Cast syscall.Stdin into an integer * DataDir -> AppDir in service_windows.go * Rename mempool-limits package to something non-main * Close database after re-assigining to it * Up rpcTimout to 10 seconds
45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package mempoollimits
|
|
|
|
import (
|
|
"path/filepath"
|
|
|
|
"github.com/jessevdk/go-flags"
|
|
"github.com/kaspanet/kaspad/stability-tests/common"
|
|
)
|
|
|
|
const (
|
|
defaultLogFilename = "mempool-limits.log"
|
|
defaultErrLogFilename = "mempool-limits_err.log"
|
|
)
|
|
|
|
var (
|
|
// Default configuration options
|
|
defaultLogFile = filepath.Join(common.DefaultAppDir, defaultLogFilename)
|
|
defaultErrLogFile = filepath.Join(common.DefaultAppDir, defaultErrLogFilename)
|
|
)
|
|
|
|
type configFlags struct {
|
|
LogLevel string `long:"loglevel" description:"Set log level {trace, debug, info, warn, error, critical}"`
|
|
Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"`
|
|
KaspadRPCAddress string `long:"rpc-address" description:"RPC address of the kaspad node"`
|
|
}
|
|
|
|
var cfg *configFlags
|
|
|
|
func activeConfig() *configFlags {
|
|
return cfg
|
|
}
|
|
|
|
func parseConfig() error {
|
|
cfg = &configFlags{}
|
|
parser := flags.NewParser(cfg, flags.PrintErrors|flags.HelpFlag|flags.IgnoreUnknown)
|
|
_, err := parser.Parse()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
initLog(defaultLogFile, defaultErrLogFile)
|
|
|
|
return nil
|
|
}
|