mimblewimble / grin-wallet

Grin Wallet
Apache License 2.0
182 stars 133 forks source link

Config file generation #478

Open reagentoo opened 4 years ago

reagentoo commented 4 years ago

It would be nice if the grin-wallet can generate grin-wallet.toml to the current directory (without any other data). It's similar how grin-server can do it:

$ grin server config
grin-server.toml file configured and created in current directory
$ ls grin*
grin-server.toml

This is useful for creating packages for different linux distributions and for being able to run with different init systems. (Systemd / OpenRC).

Let me describe more details. To start the application by the initialization system, you must bring the file storage paths to the following:

/etc/grin/grin-miner.toml
/etc/grin/grin-server.toml
/etc/grin/grin-wallet.toml

/usr/bin/grin
/usr/bin/grin-miner
/usr/bin/grin-wallet

/var/lib/grin/chain_data
/var/lib/grin/wallet_data

/var/lib/grin/.api_secret
/var/lib/grin/.foreign_api_secret
/var/lib/grin/.owner_api_secret

/var/log/grin/grin-miner.log
/var/log/grin/grin-server.log
/var/log/grin/grin-wallet.log

/etc/grin/*.toml should be installed by the package manager. But the grin-wallet doesn't provide generation of the config file.

reagentoo commented 4 years ago

Also grin-wallet does not process configuration files correctly. It is not possible to move grin-wallet.toml from working directory. .api_secret and .owner_api_secret are always recreated in the same directory of grin-wallet.toml.

tromp commented 2 years ago

Latest master build errors on this older config file:

$ ./target/debug/grin-wallet thread 'main' panicked at 'called Option::unwrap() on a None value', config/src/comments.rs:393:44 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

#########################################

WALLET CONFIGURATION

######################################### [wallet]

The chain type, which defines the genesis block and the set of cuckoo

parameters used for mining as well as wallet output coinbase maturity. Can be:

AutomatedTesting - For CI builds and instant blockchain creation

UserTesting - For regular user testing (cuckoo 16)

Floonet - For the long term Floonet test network

chain_type = "Mainnet"

host IP for wallet listener, change to "0.0.0.0" to receive grins

api_listen_interface = "127.0.0.1"

port for wallet listener

path of TLS certificate file, self-signed certificates are not supported

tls_certificate_file = ""

private key for the TLS certificate

tls_certificate_key = ""

api_listen_port = 3415

path of the secret token used by the API to authenticate the calls

comment it to disable basic auth

api_secret_path = "[REDACTED]"

location of the node api secret for basic auth on the Grin API

node_api_secret_path = "[REDACTED]"

where the wallet should find a running node

check_node_api_http_addr = "http://127.0.0.1:3413"

include the foreign API endpoints on the same port as the owner

API. Useful for networking environments like AWS ECS that make

it difficult to access multiple ports on a single service.

owner_api_include_foreign = false

where to find wallet files (seed, data, etc)

data_file_dir = "[REDACTED]"

If true, don't store calculated commits in the database

better privacy, but at a performance cost of having to

re-calculate commits every time they're used

no_commit_cache = false

Whether to use the black background color scheme for command line

dark_background_color_scheme = true

The exploding lifetime for keybase notification on coins received.

Unit: Minute. Default value 1440 minutes for one day.

Refer to https://keybase.io/blog/keybase-exploding-messages for detail.

To disable this notification, set it as 0.

keybase_notify_ttl = 1440

#########################################

LOGGING CONFIGURATION

######################################### [logging]

whether to log to stdout

log_to_stdout = true

log level for stdout: Error, Warning, Info, Debug, Trace

stdout_log_level = "Warning"

whether to log to a file

log_to_file = true

log level for file: Error, Warning, Info, Debug, Trace

file_log_level = "Debug"

log file path

log_file_path = "[REDACTED]"

whether to append to the log file (true), or replace it on every run (false)

log_file_append = true

maximum log file size in bytes before performing log rotation

comment it to disable log rotation

log_max_size = 16777216