Skip to content

Commit e350f72

Browse files
Merge pull request #39 from chrisbygrave/config-readme
Add 'fixed' to the enum options for gas oracle mode
2 parents 74605c8 + 886782e commit e350f72

File tree

6 files changed

+30
-32
lines changed

6 files changed

+30
-32
lines changed

config.md

+7-24
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,4 @@
1-
---
2-
layout: default
3-
title: pages.reference
4-
parent: Reference
5-
nav_order: 2
6-
---
7-
8-
# Configuration Reference
9-
{: .no_toc }
10-
11-
<!-- ## Table of contents
12-
{: .no_toc .text-delta }
13-
14-
1. TOC
15-
{:toc} -->
16-
17-
---
18-
1+
# Configuration reference
192

203
## api
214

@@ -68,10 +51,10 @@ nav_order: 2
6851
|credentials|CORS setting to control whether a browser allows credentials to be sent to this API|`boolean`|`true`
6952
|debug|Whether debug is enabled for the CORS implementation|`boolean`|`false`
7053
|enabled|Whether CORS is enabled|`boolean`|`true`
71-
|headers|CORS setting to control the allowed headers|`string`|`[*]`
54+
|headers|CORS setting to control the allowed headers|`[]string`|`[*]`
7255
|maxAge|The maximum age a browser should rely on CORS checks|[`time.Duration`](https://pkg.go.dev/time#Duration)|`600`
73-
|methods| CORS setting to control the allowed methods|`string`|`[GET POST PUT PATCH DELETE]`
74-
|origins|CORS setting to control the allowed origins|`string`|`[*]`
56+
|methods| CORS setting to control the allowed methods|`[]string`|`[GET POST PUT PATCH DELETE]`
57+
|origins|CORS setting to control the allowed origins|`[]string`|`[*]`
7558

7659
## debug
7760

@@ -101,7 +84,7 @@ nav_order: 2
10184

10285
|Key|Description|Type|Default Value|
10386
|---|-----------|----|-------------|
104-
|factor|Factor to increase the delay by, between each retry|`boolean`|`2`
87+
|factor|Factor to increase the delay by, between each retry|`float32`|`2`
10588
|initialDelay|Initial retry delay|[`time.Duration`](https://pkg.go.dev/time#Duration)|`250ms`
10689
|maxDelay|Maximum delay between retries|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
10790

@@ -174,7 +157,7 @@ nav_order: 2
174157
|idleTimeout|The max duration to hold a HTTP keepalive connection between calls|[`time.Duration`](https://pkg.go.dev/time#Duration)|`<nil>`
175158
|maxIdleConns|The max number of idle connections to hold pooled|`int`|`<nil>`
176159
|method|The HTTP Method to use when invoking the Gas Oracle REST API|`string`|`<nil>`
177-
|mode|The gas oracle mode|connector | restapi | disabled|`<nil>`
160+
|mode|The gas oracle mode|'connector', 'restapi', 'fixed', or 'disabled'|`<nil>`
178161
|queryInterval|The minimum interval between queries to the Gas Oracle|[`time.Duration`](https://pkg.go.dev/time#Duration)|`<nil>`
179162
|requestTimeout|The maximum amount of time that a request is allowed to remain open|[`time.Duration`](https://pkg.go.dev/time#Duration)|`<nil>`
180163
|template|REST API Gas Oracle: A go template to execute against the result from the Gas Oracle, to create a JSON block that will be passed as the gas price to the connector|[Go Template](https://pkg.go.dev/text/template) `string`|`<nil>`
@@ -213,7 +196,7 @@ nav_order: 2
213196

214197
|Key|Description|Type|Default Value|
215198
|---|-----------|----|-------------|
216-
|factor|The retry backoff factor|`boolean`|`2`
199+
|factor|The retry backoff factor|`float32`|`2`
217200
|initialDelay|The initial retry delay|[`time.Duration`](https://pkg.go.dev/time#Duration)|`250ms`
218201
|maxDelay|The maximum retry delay|[`time.Duration`](https://pkg.go.dev/time#Duration)|`30s`
219202

go.mod

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ require (
99
github.com/go-resty/resty/v2 v2.7.0
1010
github.com/gorilla/mux v1.8.0
1111
github.com/gorilla/websocket v1.5.0
12-
github.com/hyperledger/firefly-common v0.1.17-0.20220808193503-961a6b241a1a
12+
github.com/hyperledger/firefly-common v1.1.3
1313
github.com/oklog/ulid/v2 v2.1.0
1414
github.com/sirupsen/logrus v1.8.1
15-
github.com/spf13/viper v1.12.0
16-
github.com/stretchr/testify v1.7.1
15+
github.com/spf13/viper v1.12.1-0.20220712161005-5247643f0235
16+
github.com/stretchr/testify v1.8.0
1717
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
1818
golang.org/x/text v0.3.7
1919
)
@@ -44,7 +44,7 @@ require (
4444
github.com/mitchellh/reflectwalk v1.0.0 // indirect
4545
github.com/nxadm/tail v1.4.8 // indirect
4646
github.com/pelletier/go-toml v1.9.5 // indirect
47-
github.com/pelletier/go-toml/v2 v2.0.1 // indirect
47+
github.com/pelletier/go-toml/v2 v2.0.2 // indirect
4848
github.com/pkg/errors v0.9.1 // indirect
4949
github.com/pmezard/go-difflib v1.0.0 // indirect
5050
github.com/rs/cors v1.8.2 // indirect
@@ -54,7 +54,7 @@ require (
5454
github.com/spf13/cast v1.5.0 // indirect
5555
github.com/spf13/jwalterweatherman v1.1.0 // indirect
5656
github.com/spf13/pflag v1.0.5 // indirect
57-
github.com/stretchr/objx v0.2.0 // indirect
57+
github.com/stretchr/objx v0.4.0 // indirect
5858
github.com/subosito/gotenv v1.4.0 // indirect
5959
github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect
6060
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect

go.sum

+11
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,8 @@ github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs
278278
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
279279
github.com/hyperledger/firefly-common v0.1.17-0.20220808193503-961a6b241a1a h1:KQJuUGh4CdZ5XXwKjyY9M0hm//uqwcUkwpxkiIEaziQ=
280280
github.com/hyperledger/firefly-common v0.1.17-0.20220808193503-961a6b241a1a/go.mod h1:MNbaI2spBsdZYOub6Duj9xueE7Qyu9itOmJ4vE8tjYw=
281+
github.com/hyperledger/firefly-common v1.1.3 h1:srCodaJSLl8/qaq+Cse6HfHZbzYFzguerX370YGxnXU=
282+
github.com/hyperledger/firefly-common v1.1.3/go.mod h1:gMlv4Iy5JjnzXmSEdb+tWVDIc/2GhL9MRcgNX+VmI4M=
281283
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
282284
github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
283285
github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
@@ -382,6 +384,8 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v
382384
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
383385
github.com/pelletier/go-toml/v2 v2.0.1 h1:8e3L2cCQzLFi2CR4g7vGFuFxX7Jl1kKX8gW+iV0GUKU=
384386
github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo=
387+
github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw=
388+
github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI=
385389
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
386390
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
387391
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -439,10 +443,14 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
439443
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
440444
github.com/spf13/viper v1.12.0 h1:CZ7eSOd3kZoaYDLbXnmzgQI5RlciuXBMA+18HwHRfZQ=
441445
github.com/spf13/viper v1.12.0/go.mod h1:b6COn30jlNxbm/V2IqWiNWkJ+vZNiMNksliPCiuKtSI=
446+
github.com/spf13/viper v1.12.1-0.20220712161005-5247643f0235 h1:azjn5/lAGpcMny6s1fW/y6rXTu2YUOA+a2C6wKpgpkw=
447+
github.com/spf13/viper v1.12.1-0.20220712161005-5247643f0235/go.mod h1:f40df4ovE8V1ot0NXmYP1zUDS+X1D5AXGviq9fCJqZU=
442448
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
443449
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
444450
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
445451
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
452+
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
453+
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
446454
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
447455
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
448456
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
@@ -451,6 +459,9 @@ github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
451459
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
452460
github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY=
453461
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
462+
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
463+
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
464+
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
454465
github.com/subosito/gotenv v1.3.0/go.mod h1:YzJjq/33h7nrwdY+iHMhEOEEbW0ovIz0tB6t6PwAXzs=
455466
github.com/subosito/gotenv v1.4.0 h1:yAzM1+SmVcz5R4tXGsNMu1jUl2aOJXoiWUCEwwnGrvs=
456467
github.com/subosito/gotenv v1.4.0/go.mod h1:mZd6rFysKEcUhUHXJk0C/08wAgyDBFuwEYL7vWWGaGo=

internal/tmmsgs/en_config_descriptions.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ var (
5454

5555
ConfigPolicyEngineSimpleFixedGasPrice = ffc("config.policyengine.simple.fixedGasPrice", "A fixed gasPrice value/structure to pass to the connector", "Raw JSON")
5656
ConfigPolicyEngineSimpleResubmitInterval = ffc("config.policyengine.simple.resubmitInterval", "The time between warning and re-sending a transaction (same nonce) when a blockchain transaction has not been allocated a receipt", i18n.TimeDurationType)
57-
ConfigPolicyEngineSimpleGasOracleEnabled = ffc("config.policyengine.simple.gasOracle.mode", "The gas oracle mode", "connector | restapi | disabled")
57+
ConfigPolicyEngineSimpleGasOracleEnabled = ffc("config.policyengine.simple.gasOracle.mode", "The gas oracle mode", "'connector', 'restapi', 'fixed', or 'disabled'")
5858
ConfigPolicyEngineSimpleGasOracleGoTemplate = ffc("config.policyengine.simple.gasOracle.template", "REST API Gas Oracle: A go template to execute against the result from the Gas Oracle, to create a JSON block that will be passed as the gas price to the connector", i18n.GoTemplateType)
5959
ConfigPolicyEngineSimpleGasOracleURL = ffc("config.policyengine.simple.gasOracle.url", "REST API Gas Oracle: The URL of a Gas Oracle REST API to call", i18n.StringType)
6060
ConfigPolicyEngineSimpleGasOracleProxyURL = ffc("config.policyengine.simple.gasOracle.proxy.url", "Optional HTTP proxy URL to use for the Gas Oracle REST API", i18n.StringType)

pkg/fftm/config_docs_generate_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,14 @@ import (
2929
"github.com/stretchr/testify/assert"
3030
)
3131

32+
const configDocHeader = "# Configuration reference"
33+
3234
func TestGenerateConfigDocs(t *testing.T) {
3335
// Initialize config of all plugins
3436
InitConfig()
3537
f, err := os.Create(filepath.Join("..", "..", "config.md"))
3638
assert.NoError(t, err)
37-
generatedConfig, err := config.GenerateConfigMarkdown(context.Background(), config.GetKnownKeys())
39+
generatedConfig, err := config.GenerateConfigMarkdown(context.Background(), configDocHeader, config.GetKnownKeys())
3840
assert.NoError(t, err)
3941
_, err = f.Write(generatedConfig)
4042
assert.NoError(t, err)

pkg/fftm/config_docs_test.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ import (
3030
"github.com/stretchr/testify/assert"
3131
)
3232

33+
const configDocHeader = "# Configuration reference"
34+
3335
func TestConfigDocsUpToDate(t *testing.T) {
3436
// Initialize config of all plugins
3537
InitConfig()
36-
generatedConfig, err := config.GenerateConfigMarkdown(context.Background(), config.GetKnownKeys())
38+
generatedConfig, err := config.GenerateConfigMarkdown(context.Background(), configDocHeader, config.GetKnownKeys())
3739
assert.NoError(t, err)
3840
configOnDisk, err := os.ReadFile(filepath.Join("..", "..", "config.md"))
3941
assert.NoError(t, err)

0 commit comments

Comments
 (0)