mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2024-12-22 01:47:31 +01:00
docs: add README, add Makefile
dev: add Makefile docs: add README fix: Makefile
This commit is contained in:
parent
bbd4b57fa8
commit
fe9d217b60
@ -14,6 +14,7 @@ RUN go mod download
|
|||||||
COPY . .
|
COPY . .
|
||||||
RUN go build -o cic-custodial -ldflags="-X main.build=${BUILD_COMMIT} -s -w" cmd/service/*
|
RUN go build -o cic-custodial -ldflags="-X main.build=${BUILD_COMMIT} -s -w" cmd/service/*
|
||||||
|
|
||||||
|
|
||||||
FROM debian:bullseye-slim
|
FROM debian:bullseye-slim
|
||||||
|
|
||||||
ENV DEBIAN_FRONTEND=noninteractive
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
@ -25,6 +26,7 @@ COPY --from=build /build/cic-custodial .
|
|||||||
COPY migrations migrations/
|
COPY migrations migrations/
|
||||||
COPY config.toml .
|
COPY config.toml .
|
||||||
COPY queries.sql .
|
COPY queries.sql .
|
||||||
|
COPY LICENSE .
|
||||||
|
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
|
17
Makefile
Normal file
17
Makefile
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
BIN := cic-custodial
|
||||||
|
BUILD_CONF := CGO_ENABLED=1 GOOS=linux GOARCH=amd64
|
||||||
|
BUILD_COMMIT := $(shell git rev-parse --short HEAD 2> /dev/null)
|
||||||
|
|
||||||
|
.PHONY: build
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm ${BIN}
|
||||||
|
|
||||||
|
build:
|
||||||
|
${BUILD_CONF} go build -ldflags="-X main.build=${BUILD_COMMIT} -s -w" -o ${BIN} cmd/service/*
|
||||||
|
|
||||||
|
run:
|
||||||
|
${BUILD_CONF} go run cmd/service/*
|
||||||
|
|
||||||
|
run-debug:
|
||||||
|
${BUILD_CONF} go run cmd/service/* -debug
|
17
README.md
Normal file
17
README.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# cic-chain-events
|
||||||
|
|
||||||
|
![GitHub release (latest by date)](https://img.shields.io/github/v/release/grassrootseconomics/cic-custodial)
|
||||||
|
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/grassrootseconomics/cic-custodial/release.yaml)
|
||||||
|
[![Go Report Card](https://goreportcard.com/badge/github.com/grassrootseconomics/cic-custodial)](https://goreportcard.com/report/github.com/grassrootseconomics/cic-custodial)
|
||||||
|
|
||||||
|
> CIC Custodial
|
||||||
|
|
||||||
|
Experimental custodial API.
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
- [Usage](docs/usage.md)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
[AGPL-3.0](LICENSE).
|
@ -212,6 +212,7 @@ func initPub(jsCtx nats.JetStreamContext) *pub.Pub {
|
|||||||
|
|
||||||
return pub
|
return pub
|
||||||
}
|
}
|
||||||
|
|
||||||
func initSub(natsConn *nats.Conn, jsCtx nats.JetStreamContext, cu *custodial.Custodial) *sub.Sub {
|
func initSub(natsConn *nats.Conn, jsCtx nats.JetStreamContext, cu *custodial.Custodial) *sub.Sub {
|
||||||
sub, err := sub.NewSub(sub.SubOpts{
|
sub, err := sub.NewSub(sub.SubOpts{
|
||||||
CustodialContainer: cu,
|
CustodialContainer: cu,
|
||||||
|
@ -46,6 +46,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
lo.Info("main: starting cic-custodial", "build", build)
|
||||||
|
|
||||||
parsedQueries := initQueries()
|
parsedQueries := initQueries()
|
||||||
celoProvider := initCeloProvider()
|
celoProvider := initCeloProvider()
|
||||||
postgresPool := initPostgresPool()
|
postgresPool := initPostgresPool()
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
StreamName string = "CUSTODIAL"
|
streamName string = "CUSTODIAL"
|
||||||
StreamSubjects string = "CUSTODIAL.*"
|
streamSubjects string = "CUSTODIAL.*"
|
||||||
AccountNewNonce string = "CUSTODIAL.accountNewNonce"
|
AccountNewNonce string = "CUSTODIAL.accountNewNonce"
|
||||||
AccountRegister string = "CUSTODIAL.accountRegister"
|
AccountRegister string = "CUSTODIAL.accountRegister"
|
||||||
AccountGiftGas string = "CUSTODIAL.systemNewAccountGas"
|
AccountGiftGas string = "CUSTODIAL.systemNewAccountGas"
|
||||||
@ -39,13 +39,13 @@ type (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func NewPub(o PubOpts) (*Pub, error) {
|
func NewPub(o PubOpts) (*Pub, error) {
|
||||||
stream, _ := o.JsCtx.StreamInfo(StreamName)
|
stream, _ := o.JsCtx.StreamInfo(streamName)
|
||||||
if stream == nil {
|
if stream == nil {
|
||||||
_, err := o.JsCtx.AddStream(&nats.StreamConfig{
|
_, err := o.JsCtx.AddStream(&nats.StreamConfig{
|
||||||
Name: StreamName,
|
Name: streamName,
|
||||||
MaxAge: o.PersistDuration,
|
MaxAge: o.PersistDuration,
|
||||||
Storage: nats.FileStorage,
|
Storage: nats.FileStorage,
|
||||||
Subjects: []string{StreamSubjects},
|
Subjects: []string{streamSubjects},
|
||||||
Duplicates: o.DedupDuration,
|
Duplicates: o.DedupDuration,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user