Skip to content

Commit d827694

Browse files
authored
Accept config file (#1019)
1 parent 6f7b4dc commit d827694

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

sphinx/source/operators/start_network.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,43 @@ If the network has already been opened to users, members need to trust the joini
7373
.. note:: When starting up the network or when joining an existing network, the secrets required to decrypt the ledger are sealed and written to a file so that the network can later be recovered. See :ref:`operators/recovery:Catastrophic Recovery` for more details on how to recover a crashed network.
7474
.. note:: If starting up the network with PBFT enabled as the consensus protocol, be sure to add the ``--consensus pbft`` CLI argument when starting up the node. For more info on the provided consensus protocols please see :ref:`here <developers/consensus:Consensus Protocols>`
7575

76+
Using a Configuration File
77+
--------------------------
78+
79+
``cchost`` can be started using a configuration file in TOML or INI format.
80+
81+
.. code-block:: toml
82+
83+
# config.toml
84+
enclave-file = <enclave-file>
85+
enclave-type = debug
86+
consensus = raft
87+
node-address = <node-address>
88+
rpc-address = <rpc-address>
89+
public-rpc-address = <public-rpc-address>
90+
91+
[<subcommand, one of [start, join, recover]>]
92+
network-cert-file = <network-cert-file-name>
93+
member-info = "<member_cert.pem>,<member_kshare_pub.pem>"
94+
gov-script = <gov-script-name>
95+
96+
.. code-block:: ini
97+
98+
; config.ini
99+
enclave-file = <enclave-file>
100+
enclave-type = debug
101+
consensus = raft
102+
node-address = <node-address>
103+
rpc-address = <rpc-address>
104+
public-rpc-address = <public-rpc-address>
105+
106+
[<subcommand, one of [start, join, recover]>]
107+
network-cert-file = <network-cert-file-name>
108+
member-info = "<member_cert.pem>,<member_kshare_pub.pem>"
109+
gov-script = <gov-script-name>
110+
111+
To pass configuration files, use the ``--config`` option: ``./cchost --config=config.ini``. An error will be generated if the configuration file contains extra fields. Options in the configuration file will be read along with normal command line arguments. Additional information for configuration files in CLI11 can be found `here <https://cliutils.github.io/CLI11/book/chapters/config.html>`_.
112+
76113
Opening a Network to Users
77114
--------------------------
78115

sphinx/source/quickstart/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Once this is done, you can quickly spin up a CCF network and start :ref:`issuing
2020
[2019-10-29 14:48:12.138] See https://microsoft.github.io/CCF/users/issue_commands.html for more information.
2121
[2019-10-29 14:48:12.138] Press Ctrl+C to shutdown the network.
2222
23-
You should also get familiar with some of :ref:`concepts:CCF's concepts`. You will then be able to:
23+
You should also get familiar with some of :ref:`CCF's concepts <concepts:CCF Concepts>`. You will then be able to:
2424

2525
1. :ref:`Create a consortium and agree on the constitution <members/index:Member Governance>`
2626
2. :ref:`Develop a CCF application, based on the example logging application <developers/example:Example Application>`

src/host/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ int main(int argc, char** argv)
3636

3737
CLI::App app{"ccf"};
3838

39+
app.set_config("--config", "", "Read an INI or TOML file", false);
40+
app.allow_config_extras(false);
41+
3942
app.require_subcommand(1, 1);
4043

4144
std::string enclave_file;
@@ -263,6 +266,8 @@ int main(int argc, char** argv)
263266
std::string network_enc_pubk_file = "network_enc_pubk.pem";
264267

265268
auto start = app.add_subcommand("start", "Start new network");
269+
start->configurable();
270+
266271
start
267272
->add_option(
268273
"--network-cert-file",
@@ -299,6 +304,8 @@ int main(int argc, char** argv)
299304
->required();
300305

301306
auto join = app.add_subcommand("join", "Join existing network");
307+
join->configurable();
308+
302309
join
303310
->add_option(
304311
"--network-cert-file",
@@ -325,6 +332,8 @@ int main(int argc, char** argv)
325332
->required();
326333

327334
auto recover = app.add_subcommand("recover", "Recover crashed network");
335+
recover->configurable();
336+
328337
recover
329338
->add_option(
330339
"--network-cert-file",

0 commit comments

Comments
 (0)