mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-27 15:16:05 +00:00
deploy: bccb73c325d54cb51d9c3547bbf18ec49f6c4172
This commit is contained in:
parent
477df129bc
commit
8257f6c154
@ -1,12 +1,13 @@
|
|||||||
import
|
import
|
||||||
std/strutils,
|
std/[strutils, nre],
|
||||||
|
stew/results,
|
||||||
|
chronicles,
|
||||||
|
chronos,
|
||||||
confutils,
|
confutils,
|
||||||
confutils/defs,
|
confutils/defs,
|
||||||
confutils/std/net,
|
confutils/std/net,
|
||||||
confutils/toml/defs as confTomlDefs,
|
confutils/toml/defs as confTomlDefs,
|
||||||
confutils/toml/std/net as confTomlNet,
|
confutils/toml/std/net as confTomlNet,
|
||||||
chronicles,
|
|
||||||
chronos,
|
|
||||||
libp2p/crypto/crypto,
|
libp2p/crypto/crypto,
|
||||||
libp2p/crypto/secp,
|
libp2p/crypto/secp,
|
||||||
nimcrypto/utils
|
nimcrypto/utils
|
||||||
@ -14,6 +15,9 @@ import
|
|||||||
export
|
export
|
||||||
confTomlDefs,
|
confTomlDefs,
|
||||||
confTomlNet
|
confTomlNet
|
||||||
|
|
||||||
|
|
||||||
|
type ConfResult*[T] = Result[T, string]
|
||||||
|
|
||||||
type
|
type
|
||||||
WakuNodeConf* = object
|
WakuNodeConf* = object
|
||||||
@ -63,25 +67,32 @@ type
|
|||||||
defaultValue: 50
|
defaultValue: 50
|
||||||
name: "max-connections" }: uint16
|
name: "max-connections" }: uint16
|
||||||
|
|
||||||
## Persistence config
|
peerPersistence* {.
|
||||||
|
desc: "Enable peer persistence.",
|
||||||
dbPath* {.
|
defaultValue: false,
|
||||||
desc: "The database path for peristent storage",
|
name: "peer-persistence" }: bool
|
||||||
defaultValue: ""
|
|
||||||
name: "db-path" }: string
|
|
||||||
|
|
||||||
dbVacuum* {.
|
|
||||||
desc: "Enable database vacuuming at start: true|false",
|
|
||||||
defaultValue: false
|
|
||||||
name: "db-vacuum" }: bool
|
|
||||||
|
|
||||||
|
# TODO: Deprecated. Remove in next release
|
||||||
persistPeers* {.
|
persistPeers* {.
|
||||||
desc: "Enable peer persistence: true|false",
|
desc: "DEPRECATED: Use '--peer-persistence' instead.",
|
||||||
defaultValue: false
|
defaultValue: false,
|
||||||
name: "persist-peers" }: bool
|
name: "persist-peers" }: bool
|
||||||
|
|
||||||
|
# TODO: Deprecated. Remove in next release
|
||||||
|
dbPath* {.
|
||||||
|
desc: "DEPRECATED: Use '--store-message-db-url' instead",
|
||||||
|
defaultValue: "",
|
||||||
|
name: "db-path" }: string
|
||||||
|
|
||||||
|
# TODO: Deprecated. Remove in next release
|
||||||
|
dbVacuum* {.
|
||||||
|
desc: "DEPRECATED: Use '--store-message-db-vacuum' instead",
|
||||||
|
defaultValue: false,
|
||||||
|
name: "db-vacuum" }: bool
|
||||||
|
|
||||||
|
# TODO: Deprecated. Remove in next release
|
||||||
persistMessages* {.
|
persistMessages* {.
|
||||||
desc: "Enable message persistence: true|false",
|
desc: "DEPRECATED: Use '--store' instead",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "persist-messages" }: bool
|
name: "persist-messages" }: bool
|
||||||
|
|
||||||
@ -154,9 +165,9 @@ type
|
|||||||
defaultValue: ""
|
defaultValue: ""
|
||||||
name: "rln-relay-id-commitment-key" }: string
|
name: "rln-relay-id-commitment-key" }: string
|
||||||
|
|
||||||
|
# NOTE: This can be derived from the private key, but kept for future use
|
||||||
rlnRelayEthAccountAddress* {.
|
rlnRelayEthAccountAddress* {.
|
||||||
desc: "Account address for the Ethereum testnet Goerli",
|
desc: "Account address for the Ethereum testnet Goerli",
|
||||||
# NOTE: This can be derived from the private key, but kept for future use
|
|
||||||
defaultValue: ""
|
defaultValue: ""
|
||||||
name: "rln-relay-eth-account-address" }: string
|
name: "rln-relay-eth-account-address" }: string
|
||||||
|
|
||||||
@ -189,34 +200,62 @@ type
|
|||||||
defaultValue: "/waku/2/default-waku/proto"
|
defaultValue: "/waku/2/default-waku/proto"
|
||||||
name: "topics" .}: string
|
name: "topics" .}: string
|
||||||
|
|
||||||
## Store config
|
## Store and message store config
|
||||||
|
|
||||||
store* {.
|
store* {.
|
||||||
desc: "Enable store protocol: true|false",
|
desc: "Enable/disable waku store protocol",
|
||||||
defaultValue: true
|
defaultValue: true
|
||||||
name: "store" }: bool
|
name: "store" }: bool
|
||||||
|
|
||||||
|
storeMessageRetentionPolicy* {.
|
||||||
|
desc: "Message store retention policy. Time retention policy: 'time:<seconds>'. Capacity retention policy: 'capacity:<count>'",
|
||||||
|
defaultValue: "time:" & $2.days.seconds,
|
||||||
|
name: "store-message-retention-policy" }: string
|
||||||
|
|
||||||
|
storeMessageDbUrl* {.
|
||||||
|
desc: "The database connection URL for peristent storage.",
|
||||||
|
defaultValue: "sqlite://store.sqlite3",
|
||||||
|
name: "store-message-db-url" }: string
|
||||||
|
|
||||||
|
storeMessageDbVacuum* {.
|
||||||
|
desc: "Enable database vacuuming at start. Only supported by SQLite database engine.",
|
||||||
|
defaultValue: false,
|
||||||
|
name: "store-message-db-vacuum" }: bool
|
||||||
|
|
||||||
|
storeMessageDbMigration* {.
|
||||||
|
desc: "Enable database migration at start.",
|
||||||
|
defaultValue: true,
|
||||||
|
name: "store-message-db-migration" }: bool
|
||||||
|
|
||||||
|
storeResumePeer* {.
|
||||||
|
desc: "Peer multiaddress to resume the message store at boot.",
|
||||||
|
defaultValue: "",
|
||||||
|
name: "store-resume-peer" }: string
|
||||||
|
|
||||||
|
# TODO: Deprecated. Remove in next release
|
||||||
storenode* {.
|
storenode* {.
|
||||||
desc: "Peer multiaddr to query for storage.",
|
desc: "DEPRECATED: Use '--store-resume-peer' instead.",
|
||||||
defaultValue: ""
|
defaultValue: ""
|
||||||
name: "storenode" }: string
|
name: "storenode" }: string
|
||||||
|
|
||||||
|
# TODO: Deprecated. Remove in next release
|
||||||
storeCapacity* {.
|
storeCapacity* {.
|
||||||
desc: "Maximum number of messages to keep in store.",
|
desc: "DEPRECATED: Use '--store-message-retention-policy=capacity:<count>' instead",
|
||||||
defaultValue: 50000
|
defaultValue: 50000
|
||||||
name: "store-capacity" }: int
|
name: "store-capacity" }: int
|
||||||
|
|
||||||
|
# TODO: Deprecated. Remove in next release
|
||||||
sqliteStore* {.
|
sqliteStore* {.
|
||||||
desc: "Enable sqlite-only store: true|false",
|
desc: "DEPRECATED: SQLite is the default message store implementation.",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "sqlite-store" }: bool
|
name: "sqlite-store" }: bool
|
||||||
|
|
||||||
## TODO: Rename this command-line option to `storeRetentionTime`
|
# TODO: Deprecated. Remove in next release
|
||||||
sqliteRetentionTime* {.
|
sqliteRetentionTime* {.
|
||||||
desc: "time the sqlite-only store keeps messages (in seconds)",
|
desc: "DEPRECATED: Use '--store-message-retention-policy=time:<seconds>' instead",
|
||||||
defaultValue: 30.days.seconds
|
defaultValue: 30.days.seconds
|
||||||
name: "sqlite-retention-time" }: int64 # TODO: Duration
|
name: "sqlite-retention-time" }: int64
|
||||||
|
|
||||||
## Filter config
|
## Filter config
|
||||||
|
|
||||||
filter* {.
|
filter* {.
|
||||||
@ -473,3 +512,26 @@ proc readValue*(r: var TomlReader, val: var crypto.PrivateKey)
|
|||||||
except CatchableError as err:
|
except CatchableError as err:
|
||||||
raise newException(SerializationError, err.msg)
|
raise newException(SerializationError, err.msg)
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration validation
|
||||||
|
|
||||||
|
let DbUrlRegex = re"^[\w\+]+:\/\/[\w\/\\\.\:\@]+$"
|
||||||
|
|
||||||
|
proc validateDbUrl*(val: string): ConfResult[string] =
|
||||||
|
let val = val.strip()
|
||||||
|
|
||||||
|
if val == "" or val.match(DbUrlRegex).isSome():
|
||||||
|
return ok(val)
|
||||||
|
else:
|
||||||
|
return err("invalid 'db url' option format: " & val)
|
||||||
|
|
||||||
|
|
||||||
|
let StoreMessageRetentionPolicyRegex = re"^\w+:\w$"
|
||||||
|
|
||||||
|
proc validateStoreMessageRetentionPolicy*(val: string): ConfResult[string] =
|
||||||
|
let val = val.strip()
|
||||||
|
|
||||||
|
if val == "" or val.match(StoreMessageRetentionPolicyRegex).isSome():
|
||||||
|
return ok(val)
|
||||||
|
else:
|
||||||
|
return err("invalid 'store message retention policy' option format: " & val)
|
||||||
|
@ -15,4 +15,8 @@ pkgs.mkShell {
|
|||||||
libiconv
|
libiconv
|
||||||
darwin.apple_sdk.frameworks.Security
|
darwin.apple_sdk.frameworks.Security
|
||||||
];
|
];
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [
|
||||||
|
pkgs.pcre
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# libtool - Provide generalized library-building support services.
|
# libtool - Provide generalized library-building support services.
|
||||||
# Generated automatically by config.status (libbacktrace) version-unused
|
# Generated automatically by config.status (libbacktrace) version-unused
|
||||||
# Libtool was configured on host fv-az210-362:
|
# Libtool was configured on host fv-az28-635:
|
||||||
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
|
||||||
#
|
#
|
||||||
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
|
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user