problem: reading yaml to both plain properties and structured objects is a mess

solution: use just objects for configs
This commit is contained in:
Igor Artamonov
2020-03-23 22:54:52 -04:00
parent d4bd180e23
commit 014461520e
37 changed files with 528 additions and 339 deletions

View File

@@ -17,6 +17,7 @@ Create file `dshackle.yaml` with following content:
[source,yaml]
----
version: v1
host: 0.0.0.0
port: 2449
tls:
enabled: false
@@ -29,39 +30,28 @@ proxy:
- id: kovan
blockchain: kovan
upstreams:
config: "upstreams.yaml"
upstreams:
- id: infura-eth
chain: ethereum
connection:
ethereum:
rpc:
url: "https://mainnet.infura.io/v3/${INFURA_USER}"
ws:
url: "wss://mainnet.infura.io/ws/v3/${INFURA_USER}"
- id: infura-kovan
chain: kovan
connection:
ethereum:
rpc:
url: "https://kovan.infura.io/v3/${INFURA_USER}"
----
This very basic config says that:
- application will listen for connections on 0.0.0.0:2449
- TLS security should be disabled (_never use in production!_)
- read upstreams configuration from file `upstreams.yaml` in current directory
Now create file `upstreams.yaml`:
[source,yaml]
----
version: v1
upstreams:
- id: infura-eth
chain: ethereum
connection:
ethereum:
rpc:
url: "https://mainnet.infura.io/v3/${INFURA_USER}"
ws:
url: "wss://mainnet.infura.io/ws/v3/${INFURA_USER}"
- id: infura-kovan
chain: kovan
connection:
ethereum:
rpc:
url: "https://kovan.infura.io/v3/${INFURA_USER}"
----
This config:
- setups 2 upstreams, one for Ethereum Mainnet and another for Kovan Testnet (both upstreams are configured for Infura for demo purposes, but you can use other compatible endpoints)
- application listen for gRPC connections on 0.0.0.0:2449, with TLS security disabled (_never use in production!_)
- listen for HTTP JSON RPC connections on 0.0.0.0:8545, without TLS security too (again, _don't use in production, it's insecure_)
- sets up 2 upstreams, one for Ethereum Mainnet and another for Kovan Testnet (both upstreams are configured for Infura for demo purposes, but you can use other compatible endpoints)
- for Ethereum Mainnet it connects using JSON RPC and Websockets connections, for Kovan just JSON RPC is used
- Infura authentication config is omitted for this demo
- `${INFURA_USER}` value can be provided through environment variables

View File

@@ -17,7 +17,7 @@ tls:
require: true
ca: "ca.crt"
upstreams:
config: "upstreams.yaml"
include: "upstreams.yaml"
----
It configures following:

View File

@@ -17,7 +17,7 @@ Those protocols can be configures with additional security, TLS and authenticati
----
version: v1
defaultOptions:
defaults:
- chains:
- ethereum
options:

View File

@@ -12,7 +12,7 @@ docker run -p 2449:2449 -v $(pwd):/config -w /config emeraldpay/dshackle
=== Install & Run manually
1. Download latest release from https://github.com/emeraldpay/dshackle/releases
2. Unpack `unzip dshackle-0.3.zip`
2. Unpack `unzip dshackle-0.6.zip`
3. Copy to `/opt/dshackle`
4. Setup configuration in `/etc/dshackle`
5. Run as `cp /etc/dshackle && /opt/dshackle/bin/dshackle`