Skip to content
This repository was archived by the owner on Jan 9, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions config/default.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
Cache:
defaultModule: "cache_fs"
#port: 8126
#workers: 2
#log-level: 3
options:
cache_ram:
cachePath: ".cache_ram"
Expand Down
9 changes: 6 additions & 3 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ function collect(val, memo) {
}

const defaultCacheModule = config.get("Cache.defaultModule");
const defaultCachePort = config.has('Cache.port') ? config.get('Cache.port') : consts.DEFAULT_PORT;
const defaultLogLevel = config.has('Cache.log-level') ? config.get('Cache.log-level') : consts.DEFAULT_LOG_LEVEL;
const defaultWorkers = config.has('Cache.workers') ? config.get('Cache.workers') : consts.DEFAULT_WORKERS

program.description("Unity Cache Server")
.version(VERSION)
.allowUnknownOption(true)
.option('-p, --port <n>', 'Specify the server port, only apply to new cache server', myParseInt, consts.DEFAULT_PORT)
.option('-p, --port <n>', 'Specify the server port, only apply to new cache server', myParseInt, defaultCachePort)
.option('-c --cache-module [path]', 'Use cache module at specified path', defaultCacheModule)
.option('-P, --cache-path [path]', 'Specify the path of the cache directory')
.option('-l, --log-level <n>', 'Specify the level of log verbosity. Valid values are 0 (silent) through 5 (debug)', myParseInt, consts.DEFAULT_LOG_LEVEL)
.option('-w, --workers <n>', 'Number of worker threads to spawn', zeroOrMore, consts.DEFAULT_WORKERS)
.option('-l, --log-level <n>', 'Specify the level of log verbosity. Valid values are 0 (silent) through 5 (debug)', myParseInt, defaultLogLevel)
.option('-w, --workers <n>', 'Number of worker threads to spawn', zeroOrMore, defaultWorkers)
.option('-m --mirror [host:port]', 'Mirror transactions to another cache server. Can be repeated for multiple mirrors', collect, [])
.option('--dump-config', 'Write the active configuration to the console')
.option('--save-config [path]', 'Write the active configuration to the specified file and exit. Defaults to ./default.yml')
Expand Down