Skip to content

Commit

Permalink
Merge d14c9b5 into f3cd8c0
Browse files Browse the repository at this point in the history
  • Loading branch information
yaronsumel committed Oct 14, 2018
2 parents f3cd8c0 + d14c9b5 commit 015fbc3
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 21 deletions.
11 changes: 6 additions & 5 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,12 @@ import (
// AppConfig is the main config structure
// export DIGOTA_LOCKER...=val
type AppConfig struct {
TLS TLS
Clients []Client
Payment []PaymentProvider
Storage Storage
Locker Locker
TLS TLS
Clients []Client
Payment []PaymentProvider
Storage Storage
Locker Locker
Insecure bool
}

// Client is the client config structure
Expand Down
5 changes: 5 additions & 0 deletions docker/build/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM golang:1.11

RUN go get -u github.com/digota/digota

CMD [ "digota" ]
32 changes: 32 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: '3'
services:

digota:
image: digota/digota:0.1
ports:
- 80:80
environment:
DIGOTA_INSECURE: true
DIGOTA_STORAGE_HANDLER: mongodb
DIGOTA_STORAGE_ADDRESS: mongodb:27017
DIGOTA_LOCKER_HANDLER: zookeeper
DIGOTA_LOCKER_ADDRESS: zookeeper:2181
depends_on:
- zookeeper
- mongodb

zookeeper:
image: zookeeper
restart: unless-stopped
ports:
- 2181:2181
environment:
ZOO_MY_ID: 1
ZOO_SERVERS: server.1=0.0.0.0:2888:3888

mongodb:
image: mvertes/alpine-mongo:3.2.3
restart: unless-stopped
ports:
- "27017:27017"

12 changes: 3 additions & 9 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,8 @@ const (
)

var (
app = cli.NewApp()
addr = port
insecure = false
app = cli.NewApp()
addr = port
)

func init() {
Expand Down Expand Up @@ -100,11 +99,6 @@ func main() {
Value: ":3051",
Destination: &addr,
},
cli.BoolFlag{
Name: "insecure",
Usage: "Skip auth and tls configurations",
Destination: &insecure,
},
}
// prepare things up
app.Action = func(c *cli.Context) error {
Expand All @@ -123,7 +117,7 @@ func main() {
log.Fatalf("Could not load config => %s", err.Error())
}
// create new server and run on port , Run() will block
server.New(addr, conf, insecure).Run()
server.New(addr, conf).Run()
return nil
}
// run with os.args
Expand Down
15 changes: 8 additions & 7 deletions server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ import (
import (
"crypto/tls"
"crypto/x509"
"io/ioutil"
"net"
"os"
"os/signal"
"syscall"

"github.com/digota/digota/acl"
"github.com/digota/digota/client"
"github.com/digota/digota/config"
Expand All @@ -60,11 +66,6 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/reflection"
"google.golang.org/grpc/status"
"io/ioutil"
"net"
"os"
"os/signal"
"syscall"
)

type server struct {
Expand All @@ -73,9 +74,9 @@ type server struct {
}

// New create new digota server
func New(addr string, conf *config.AppConfig, insecure bool) *server {
func New(addr string, conf *config.AppConfig) *server {

if insecure {
if conf.Insecure {
acl.SetSkipAuth()
}

Expand Down

0 comments on commit 015fbc3

Please sign in to comment.