Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Commit

Permalink
Merge pull request #514 from adamdecaf/viper-config
Browse files Browse the repository at this point in the history
config: use viper for parsing config which allows for case-insensitive
  • Loading branch information
adamdecaf authored Jul 6, 2020
2 parents fa24754 + c7e40dd commit fd23ce6
Show file tree
Hide file tree
Showing 15 changed files with 316 additions and 174 deletions.
70 changes: 35 additions & 35 deletions docs/config.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Configuration

PayGate uses a file based config for modifying the default way it operates. Various settings can be changed with this file which is written in [YAML format](https://en.wikipedia.org/wiki/YAML).
PayGate uses a file based config for modifying the default way it operates. Various settings can be changed with this file which is written in [YAML format](https://en.wikipedia.org/wiki/YAML). Key names are case-insensitive.

Use the command-line flag `-config <filename>` for specifying where to read this file from.

Expand Down Expand Up @@ -32,16 +32,16 @@ logging:
```yaml
http:
# Address for paygate to bind its HTTP server on.
[ bind_address: <string> | default = ":8082" ]
[ bindAddress: <string> | default = ":8082" ]
```
### Admin
```yaml
admin:
# Address for paygate to bind its admin HTTP server on.
[ bind_address: <strong> | default = ":9092" ]
[ disable_config_endpoint: <boolean> | default = false ]
[ bindAddress: <strong> | default = ":9092" ]
[ disableConfigEndpoint: <boolean> | default = false ]
```
### Database
Expand All @@ -67,15 +67,15 @@ database:
odfi:
# The ABA routing number to use and run PayGate under.
# Example: 987654320
routing_number: <string>
routingNumber: <string>

# Gateway holds FileHeader information which the ODFI requires is set
# on all files uploaded.
gateway:
[ origin: <string> ]
[ origin_name: <string> ]
[ originName: <string> ]
[ destination: <string> ]
[ destination_name: <string> ]
[ destinationName: <string> ]

cutoffs:
# An IANA Timezone used to determine when to upload ACH files to the ODFI.
Expand All @@ -88,45 +88,45 @@ odfi:
- <string>

# These paths point to directories on the remote FTP/SFTP server.
inbound_path: <filename>
outbound_path: <filename>
return_path: <filename>
inboundPath: <filename>
outboundPath: <filename>
returnPath: <filename>

# Comma separated list of IP addresses and CIDR ranges where connections
# are allowed. If this value is non-empty remote servers not within these
# ranges will not be connected to.
[ allowed_ips: <string> ]
[ allowedIPs: <string> ]

# Go template string of filenames for the remote server.
[ outbound_filename_template: <tmpl-string> ]
[ outboundFilenameTemplate: <tmpl-string> ]

# Configuration for using a remote File Transfer Protocol server
# for ACH file uploads.
ftp:
hostname: <host>
username: <string>
[ password: <secret> ]
[ ca_file: <filename> ]
[ dial_timeout: <duration> | default = 10s ]
[ caFile: <filename> ]
[ dialTimeout: <duration> | default = 10s ]
# Offer EPSV to be used if the FTP server supports it.
[ disabled_epsv: <boolean> | default = false ]
[ disabledEPSV: <boolean> | default = false ]

# Configuration for using a remote SSH File Transfer Protocol server
# for ACH file uploads
sftp:
hostname: <host>
username: <string>
[ password: <secret> ]
[ client_private_key: <filename> ]
[ host_public_key: <filename> ]
[ dial_timeout: <duration> | default = 10s ]
[ max_connections_per_file: <number> | default = 8 ]
[ clientPrivateKey: <filename> ]
[ hostPublicKey: <filename> ]
[ dialTimeout: <duration> | default = 10s ]
[ maxConnectionsPerFile: <number> | default = 8 ]
# Sets the maximum size of the payload, measured in bytes.
# Try lowering this on "failed to send packet header: EOF" errors.
[ max_packet_size: <number> | default = 20480 ]
[ maxPacketSize: <number> | default = 20480 ]

transfers:
[ balance_entries: <boolean> | default = false ]
[ balanceEntries: <boolean> | default = false ]
addendum:
[ create05: <boolean> | default = false ]

Expand All @@ -135,10 +135,10 @@ odfi:
# Leaving these files around helps debugging, but also exposes customer information.
# Empty directories are deleted and if no files are downloaded the entire temporary
# directory is removed.
[ cleanup_local_directory: <boolean> | default = false ]
[ cleanupLocalDirectory: <boolean> | default = false ]

# Should we delete the remote file on an ODFI's server after downloading and processing of each file.
[ keep_remote_files: <boolean> | default = false ]
[ keepRemoteFiles: <boolean> | default = false ]

local:
[ directory: <filename> ]
Expand All @@ -148,30 +148,30 @@ odfi:
```yaml
pipeline:
pre_upload:
preUpload:
gpg:
[ key_file: <filename> ]
[ keyFile: <filename> ]
signer:
[ key_file: <filename> ]
[ keyFile: <filename> ]
# Optional password to decrypt this private key.
# It can also be set with PIPELINE_SIGNING_KEY_PASSWORD as an environment variable
[ key_password: <secret> ]
[ keyPassword: <secret> ]
output:
# Which encoding to use when writing ACH files to the remote.
# Options: base64, encrypted-bytes, nacha
[ format: <string> | default = "nacha" ]
merging:
[ directory: <filename> ]
audit_trail:
auditTrail:
# BucketURI is a URI used to connect to a remote storage layer for saving
# ACH files uploaded to the ODFI as part of records retention.
# See the provider docs for more information: https://gocloud.dev/howto/blob/
#
# Example: gs://my-bucket
bucket_uri: <string>
bucketURI: <string>
gpg:
# Optional filepath used for encrypting ACH files when they're saved for auditing
[ key_file: <filename> ]
[ keyFile: <filename> ]
stream:
inmem:
[ url: <address> ]
Expand All @@ -191,13 +191,13 @@ pipeline:
# - insecure_skip_verify is an optional parameter for disabling certificate verification
#
# Example: smtps://user:pass@localhost:1025/?insecure_skip_verify=true
connection_uri: <string>
connectionURI: <string>
[ template: <tmpl-string> ]
company_name: <string>
companyName: <string>
pagerduty:
[ api_key: <secret> ]
[ apiKey: <secret> ]
slack:
[ webhook_url: <secret> ]
[ webhookURL: <secret> ]
```
### Validation
Expand All @@ -209,7 +209,7 @@ pipeline:
# Currently micro-deposits (two small credits and a debit of their sum) is the only allowed method
# of account validation.
validation:
micro_deposits:
microDeposits:
source:
# ID from the Customers service for the source of micro-deposit funds
customerID: <string>
Expand Down
24 changes: 12 additions & 12 deletions examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,27 @@ database:
sqlite:
path: "paygate.db"
odfi:
routing_number: "987654320"
routingNumber: "987654320"
gateway:
# origin is often an ABA routing number
origin: "987654320"
# origin_name is the name of your ODFI
origin_name: "My Bank"
originName: "My Bank"
# destination can be the ABA routing number of the Federal Reserve bank used
destination: "071000301"
# destination_name would be name of Federal Reserve bank used
destination_name: "FRBATLANTA"
inbound_path: "./inbound/"
outbound_path: "./outbound/"
return_path: "./returned/"
destinationName: "FRBATLANTA"
inboundPath: "./inbound/"
outboundPath: "./outbound/"
returnPath: "./returned/"
cutoffs:
timezone: "America/New_York"
windows:
- "16:20" # 4:20pm EST
inbound:
interval: "10m"
transfers:
balance_entries: true
balanceEntries: true
ftp:
hostname: "localhost:2121"
username: "admin"
Expand All @@ -41,12 +41,12 @@ odfi:
# username: "demo"
# password: "password"
storage:
cleanup_local_directory: true
keep_remote_files: false
cleanupLocalDirectory: true
keepRemoteFiles: false
local:
directory: "./storage/"
validation:
micro_deposits:
microDeposits:
source:
# Example ID's from Moov Customers service
customerID: "customer"
Expand All @@ -63,5 +63,5 @@ pipeline:
to:
- "[email protected]"
- "[email protected]"
connection_uri: "smtps://test:test@localhost:1025/?insecure_skip_verify=true"
company_name: "Moov"
connectionURI: "smtps://test:test@localhost:1025/?insecure_skip_verify=true"
companyName: "Moov"
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ require (
github.com/pkg/sftp v1.11.0
github.com/prometheus/client_golang v1.6.0
github.com/robfig/cron/v3 v3.0.1
github.com/spf13/viper v1.7.0
github.com/uber/jaeger-client-go v2.23.0+incompatible
github.com/uber/jaeger-lib v2.2.0+incompatible
go.uber.org/atomic v1.6.0 // indirect
Expand All @@ -40,5 +41,5 @@ require (
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/text v0.3.2
gopkg.in/yaml.v2 v2.2.8
gopkg.in/yaml.v2 v2.2.8 // indirect
)
Loading

0 comments on commit fd23ce6

Please sign in to comment.