-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* First implemtation of a flag flag/config handling * Adding an example config file * Remove unused config package * Move config stuff to a separate package * Get rid of manually maintained flag list * Load parses os args by default * Add tests for config loading * Updating readme and adding comments
- Loading branch information
Showing
14 changed files
with
825 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# role this node will have in the network | ||
# role: head | ||
|
||
# how many requests should the node process in parallel | ||
# concurrency: 10 | ||
|
||
# directory where node will keep files needed for operation | ||
# workspace: workspace | ||
|
||
# directory where node will maintain its peer database | ||
# peer-db: pdb | ||
|
||
# directory where node will maintain its function database | ||
# function-db: fdb | ||
|
||
# multiaddresses of nodes this node will try to connect to on boot | ||
# boot-nodes: [] | ||
|
||
# should the node load its attributes from IPFS/IPNS | ||
# attributes: false | ||
|
||
# log information | ||
# log: | ||
# level: debug | ||
|
||
# connectivity information | ||
# connectivity: | ||
|
||
# address: 0.0.0.0 | ||
# port: 9000 | ||
|
||
# private key this node will use for its operation. | ||
# this determines how this node is identified on the network | ||
# private-key: /path/to/private/key | ||
|
||
# external address that the node will advertise | ||
# dialback-address: 10.10.10.10 | ||
|
||
# external port that the node will advertise | ||
# dialback-port: 9000 | ||
|
||
# use websocket protocol for communication | ||
# websocket: false | ||
|
||
# port to use for websocket communication | ||
# websocket-port: 9010 | ||
|
||
# external port the node will advertise for websocket communication | ||
# websocket-dialback-port: 9010 | ||
|
||
|
||
# head node configuration | ||
# head: | ||
# where will the head node serve the REST API | ||
# rest-api: localhost:8888 | ||
|
||
# worker node configuration | ||
# worker: | ||
# local path to Blockless Runtime | ||
# runtime-path: /path/to/blockless/runtime | ||
|
||
# max percentage of CPU time Blockless will use for execution (1.0 for 100%) | ||
# cpu-percentage-limit: 1.0 | ||
|
||
# max amount of memory (in kB) Blockless will use for execution (0 is unlimited) | ||
# memory-limit: 0 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package config | ||
|
||
// Config type is tightly coupled with the config options defined in flags.go. | ||
// Flag name should be the same as the value in the `koanf` tag here (flag is `--dialback-address`, the koanf tag is `dialback-address`). | ||
// This is needed so the two ways of loading config are correctly merged. | ||
// | ||
// The `group` of the config option defines in which section of the config file it lives. | ||
// Examples: | ||
// connectivity => address, port, private-key... | ||
// worker => runtime-path, runtime-cli, cpu-percentage-limit... | ||
// | ||
|
||
// Config describes the Blockless configuration options. | ||
type Config struct { | ||
Role string `koanf:"role"` | ||
Concurrency uint `koanf:"concurrency"` | ||
BootNodes []string `koanf:"boot-nodes"` | ||
Workspace string `koanf:"workspace"` // TODO: Check - does a head node ever use a workspace? | ||
LoadAttributes bool `koanf:"attributes"` // TODO: Head node probably doesn't need attributes..? | ||
Topics []string `koanf:"topics"` | ||
|
||
PeerDatabasePath string `koanf:"peer-db"` | ||
FunctionDatabasePath string `koanf:"function-db"` // TODO: Head node doesn't need a function database. | ||
|
||
Log Log `koanf:"log"` | ||
Connectivity Connectivity `koanf:"connectivity"` | ||
Head Head `koanf:"head"` | ||
Worker Worker `koanf:"worker"` | ||
} | ||
|
||
// Log describes the logging configuration. | ||
type Log struct { | ||
Level string `koanf:"level"` | ||
} | ||
|
||
// Connectivity describes the libp2p host that the node will use. | ||
type Connectivity struct { | ||
Address string `koanf:"address"` | ||
Port uint `koanf:"port"` | ||
PrivateKey string `koanf:"private-key"` | ||
DialbackAddress string `koanf:"dialback-address"` | ||
DialbackPort uint `koanf:"dialback-port"` | ||
Websocket bool `koanf:"websocket"` | ||
WebsocketPort uint `koanf:"websocket-port"` | ||
WebsocketDialbackPort uint `koanf:"websocket-dialback-port"` | ||
} | ||
|
||
type Head struct { | ||
API string `koanf:"rest-api"` | ||
} | ||
|
||
type Worker struct { | ||
RuntimePath string `koanf:"runtime-path"` | ||
RuntimeCLI string `koanf:"runtime-cli"` | ||
CPUPercentageLimit float64 `koanf:"cpu-percentage-limit"` | ||
MemoryLimitKB int64 `koanf:"memory-limit"` | ||
} |
Oops, something went wrong.