REST API server for form3 payments model
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmd/form3-payments-server
models
restapi
store
vendor
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
README.md
swagger.yaml

README.md

Form3 Payments API Server

REST API server for payments model

Build Status License MIT

Install

go get github.com/MarinX/form3-payments/cmd/...

Running

$ ./form3-payments-server --help
Usage:
  form3-payments-server [OPTIONS]

Application Options:
      --scheme=            the listeners to enable, this can be repeated and defaults to the schemes in the swagger spec
      --cleanup-timeout=   grace period for which to wait before killing idle connections (default: 10s)
      --graceful-timeout=  grace period for which to wait before shutting down the server (default: 15s)
      --max-header-size=   controls the maximum number of bytes the server will read parsing the request header's keys and values, including the request line. It does not limit the size of the request body. (default: 1MiB)
      --socket-path=       the unix socket to listen on (default: /var/run/form3-payments.sock)
      --host=              the IP to listen on (default: localhost) [$HOST]
      --port=              the port to listen on for insecure connections, defaults to a random value [$PORT]
      --listen-limit=      limit the number of outstanding requests
      --keep-alive=        sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download) (default: 3m)
      --read-timeout=      maximum duration before timing out read of the request (default: 30s)
      --write-timeout=     maximum duration before timing out write of the response (default: 60s)
      --tls-host=          the IP to listen on for tls, when not specified it's the same as --host [$TLS_HOST]
      --tls-port=          the port to listen on for secure connections, defaults to a random value [$TLS_PORT]
      --tls-certificate=   the certificate to use for secure connections [$TLS_CERTIFICATE]
      --tls-key=           the private key to use for secure conections [$TLS_PRIVATE_KEY]
      --tls-ca=            the certificate authority file to be used with mutual tls auth [$TLS_CA_CERTIFICATE]
      --tls-listen-limit=  limit the number of outstanding requests
      --tls-keep-alive=    sets the TCP keep-alive timeouts on accepted connections. It prunes dead TCP connections ( e.g. closing laptop mid-download)
      --tls-read-timeout=  maximum duration before timing out read of the request
      --tls-write-timeout= maximum duration before timing out write of the response

Service Options:
  -s, --store=             Which database to use, default boltdb (default: boltdb) [$STORE_TYPE]
  -d, --debug              Use debug mode [$DEBUG_MODE]

Help Options:
  -h, --help               Show this help message

Tests

go test -v ./...

Store

Default store is boltDB but you can add any other (SQL/NoSQL) by creating package in store/db_name.go

The database must follow this interface

type Store interface {
	Open() error
	Close() error
	Get(interface{}, interface{}) error
	Create(interface{}) error
	Update(interface{}) error
	Delete(interface{}) error
	List(interface{}, int, int, map[string]interface{}) error
	Count(interface{}) (int, error)
}

Swagger

This server is generated by go-swagger.

Check swagger.yaml for more details

License

MIT