Skip to content

Commit

Permalink
Add reflection mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
anbsky committed Sep 12, 2019
1 parent dba4889 commit c93495f
Show file tree
Hide file tree
Showing 10 changed files with 615 additions and 9 deletions.
34 changes: 34 additions & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ type DBConfig struct {
Options string
}

type ReflectorConfig struct {
AWSID string
AWSSecret string
Region string
Bucket string
DBConn string
}

var once sync.Once
var Config *ConfigWrapper

Expand Down Expand Up @@ -63,6 +71,12 @@ func (c *ConfigWrapper) Init() {
c.Viper.SetDefault("AccountsEnabled", false)
c.Viper.BindEnv("AccountsEnabled")

c.Viper.BindEnv("ReflectorAWSID", "REFLECTOR_AWS_ID")
c.Viper.BindEnv("ReflectorAWSSecret", "REFLECTOR_AWS_SECRET")
c.Viper.BindEnv("ReflectorBucketRegion", "REFLECTOR_BUCKET_REGION")
c.Viper.BindEnv("ReflectorBucketName", "REFLECTOR_BUCKET_NAME")
c.Viper.BindEnv("ReflectorDBConn", "REFLECTOR_DB_CONN")

c.Viper.SetConfigName("lbrytv") // name of config file (without extension)

c.Viper.AddConfigPath(os.Getenv("LBRYTV_CONFIG_DIR"))
Expand Down Expand Up @@ -171,3 +185,23 @@ func GetProjectURL() string {
func GetPublishSourceDir() string {
return Config.Viper.GetString("PublishSourceDir")
}

// GetBlobFilesDir returns directory where SDK instance stores blob files.
func GetBlobFilesDir() string {
return Config.Viper.GetString("BlobFilesDir")
}

func GetReflectorConfig() *ReflectorConfig {
v := Config.Viper
cfg := ReflectorConfig{
AWSID: v.GetString("ReflectorAWSID"),
AWSSecret: v.GetString("ReflectorAWSSecret"),
Region: v.GetString("ReflectorBucketRegion"),
Bucket: v.GetString("ReflectorBucketName"),
DBConn: v.GetString("ReflectorDBConn"),
}
if cfg.AWSID != "" {
return &cfg
}
return nil
}
1 change: 1 addition & 0 deletions deployments/docker-dev/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ services:
environment:
LW_LBRYNET: http://lbrynet:5279/
LW_ACCOUNTSENABLED: 1
env_file: secrets.env
depends_on:
- lbrynet
- postgres
Expand Down
1 change: 1 addition & 0 deletions deployments/docker-production/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ services:
environment:
LW_LBRYNET: http://lbrynet:5279/
LW_ACCOUNTSENABLED: 1
env_file: secrets.env
depends_on:
- lbrynet
- postgres
Expand Down
1 change: 1 addition & 0 deletions deployments/docker/app/config/lbrytv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ MetricsAddress: :2112
MetricsPath: /metrics

PublishSourceDir: /storage/publish
BlobFilesDir: /storage/lbrynet/blobfiles
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ services:
target: /storage
environment:
LW_LBRYNET: http://lbrynet:5279/
env_file: secrets.env
depends_on:
- lbrynet
- postgres
Expand Down
74 changes: 65 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,51 +1,107 @@
module github.com/lbryio/lbrytv

require (
cloud.google.com/go v0.45.1 // indirect
github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/aws/aws-sdk-go v1.23.19 // indirect
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3 // indirect
github.com/btcsuite/goleveldb v1.0.0 // indirect
github.com/coreos/bbolt v1.3.3 // indirect
github.com/coreos/etcd v3.3.15+incompatible // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f // indirect
github.com/getsentry/sentry-go v0.2.1
github.com/go-ini/ini v1.46.0 // indirect
github.com/go-kit/kit v0.9.0 // indirect
github.com/go-ozzo/ozzo-validation v3.6.0+incompatible // indirect
github.com/gobuffalo/packr v1.30.1 // indirect
github.com/gobuffalo/packr/v2 v2.5.1
github.com/gofrs/uuid v3.2.0+incompatible // indirect
github.com/golang/protobuf v1.3.2 // indirect
github.com/gogo/protobuf v1.3.0 // indirect
github.com/google/go-cmp v0.3.1 // indirect
github.com/google/pprof v0.0.0-20190908185732-236ed259b199 // indirect
github.com/gopherjs/gopherjs v0.0.0-20190910122728-9d188e94fb99 // indirect
github.com/gorilla/mux v1.7.3
github.com/gorilla/rpc v1.2.0 // indirect
github.com/gorilla/websocket v1.4.1 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.11.1 // indirect
github.com/hashicorp/go-immutable-radix v1.1.0 // indirect
github.com/hashicorp/go-retryablehttp v0.6.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.2 // indirect
github.com/hashicorp/golang-lru v0.5.3 // indirect
github.com/hashicorp/mdns v1.0.1 // indirect
github.com/hashicorp/serf v0.8.3 // indirect
github.com/jessevdk/go-flags v1.4.0 // indirect
github.com/jinzhu/gorm v1.9.9
github.com/jmoiron/sqlx v1.2.0
github.com/kat-co/vala v0.0.0-20170210184112-42e1d8b61f12
github.com/kkdai/bstream v1.0.0 // indirect
github.com/kr/pty v1.1.8 // indirect
github.com/lbryio/lbry.go v0.0.0-20190902174752-0cfc8e230c79
github.com/lbryio/reflector.go v1.1.0

github.com/lbryio/types v0.0.0-20190715201353-fe180635eafe // indirect
github.com/lib/pq v1.1.1
github.com/lusis/slack-test v0.0.0-20190426140909-c40012f20018 // indirect
github.com/magiconair/properties v1.8.1 // indirect
github.com/mattn/go-colorable v0.1.2 // indirect
github.com/mattn/go-isatty v0.0.9 // indirect
github.com/miekg/dns v1.1.17 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.1 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/nlopes/slack v0.6.0 // indirect
github.com/onsi/ginkgo v1.10.1 // indirect
github.com/onsi/gomega v1.7.0 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/pelletier/go-toml v1.4.0 // indirect
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 // indirect
github.com/pingcap/errors v0.11.4 // indirect
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v1.0.0
github.com/prometheus/common v0.6.0 // indirect
github.com/prometheus/procfs v0.0.3 // indirect
github.com/rogpeppe/go-internal v1.3.1 // indirect
github.com/posener/complete v1.2.1 // indirect
github.com/prometheus/client_golang v1.1.0
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 // indirect
github.com/prometheus/procfs v0.0.4 // indirect
github.com/rogpeppe/fastuuid v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.3.2 // indirect
github.com/rubenv/sql-migrate v0.0.0-20190618074426-f4d34eae5a5c
github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24 // indirect
github.com/russross/blackfriday v2.0.0+incompatible // indirect
github.com/sebdah/goldie v0.0.0-20190531093107-d313ffb52c77 // indirect
github.com/shopspring/decimal v0.0.0-20190905144223-a36b5d85f337 // indirect
github.com/sirupsen/logrus v1.4.2
github.com/smartystreets/assertions v1.0.1 // indirect
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 // indirect
github.com/spf13/afero v1.2.2 // indirect
github.com/spf13/cobra v0.0.5
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/viper v1.4.0
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.4.0
github.com/uber-go/atomic v1.4.0 // indirect
github.com/ugorji/go v1.1.7 // indirect
github.com/volatiletech/inflect v0.0.0-20170731032912-e7201282ae8d // indirect
github.com/volatiletech/null v8.0.0+incompatible
github.com/volatiletech/sqlboiler v3.4.0+incompatible
github.com/ybbus/jsonrpc v2.1.2+incompatible
github.com/ziutek/mymysql v1.5.4 // indirect
golang.org/x/crypto v0.0.0-20190829043050-9756ffdc2472 // indirect
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297 // indirect
golang.org/x/sys v0.0.0-20190902133755-9109b7679e13 // indirect
go.etcd.io/bbolt v1.3.3 // indirect
go.opencensus.io v0.22.1 // indirect
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7 // indirect
golang.org/x/exp v0.0.0-20190829153037-c13cbed26979 // indirect
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a // indirect
golang.org/x/lint v0.0.0-20190909230951-414d861bb4ac // indirect
golang.org/x/mobile v0.0.0-20190910184405-b558ed863381 // indirect
golang.org/x/net v0.0.0-20190909003024-a7b16738d86b // indirect
golang.org/x/sys v0.0.0-20190910064555-bbd175535a8b // indirect
golang.org/x/tools v0.0.0-20190911022129-16c5e0f7d110 // indirect
google.golang.org/api v0.10.0 // indirect
google.golang.org/appengine v1.6.2 // indirect
google.golang.org/genproto v0.0.0-20190905072037-92dd089d5514 // indirect
google.golang.org/grpc v1.23.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/gorp.v1 v1.7.2 // indirect
gopkg.in/ini.v1 v1.46.0 // indirect
honnef.co/go/tools v0.0.1-2019.2.3 // indirect
)

0 comments on commit c93495f

Please sign in to comment.