From f5fa94cc9ce1b4a6924d1067f91a8fde8b95516e Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Mon, 4 Jan 2021 00:42:13 -0500 Subject: [PATCH] chore: remove dburl usage dburl adds aliases for everything, which breaks if two schemes are similar enough (anything with `aws_` as a prefix broke scheme registration). It does not appear to add anything, so we'll drop that dependency. Also remove go-jsonmerge, as this was refactored to use structs instead of byte manipulation... --- plugins/logs/functions.go | 58 +-------------------------------------- plugins/logs/go.mod | 2 -- plugins/logs/go.sum | 12 -------- 3 files changed, 1 insertion(+), 71 deletions(-) diff --git a/plugins/logs/functions.go b/plugins/logs/functions.go index 4040ad04e..35856b520 100644 --- a/plugins/logs/functions.go +++ b/plugins/logs/functions.go @@ -11,7 +11,6 @@ import ( "github.com/dokku/dokku/plugins/common" "github.com/joncalhoun/qson" - "github.com/xo/dburl" ) type vectorConfig struct { @@ -28,61 +27,6 @@ type vectorSink map[string]interface{} const vectorContainerName = "vector" -func init() { - sinks := []string{ - "aws_cloudwatch_logs", - "aws_kinesis_firehose", - "aws_kinesis_streams", - "aws_s3", "aws_sqs", - "azure_monitor_logs", - "blackhole", - "clickhouse", - "console", - "datadog_logs", - "elasticsearch", - "file", - "gcp_cloud_storage", - "gcp_pubsub", - "gcp_stackdriver_logs", - "honeycomb", - "http", - "humio_logs", - "influxdb_logs", - "kafka", - "logdna", - "loki", - "nats", - "new_relic_logs", - "papertrail", - "pulsar", - "sematext_logs", - "socket", - "splunk_hec", - "vector", - } - for _, sink := range sinks { - dburl.Register(dburl.Scheme{ - Driver: sink, - Generator: genOpaqueWithMissingPath, - Proto: 0, - Opaque: false, - Aliases: []string{}, - Override: "", - }) - } -} - -func genOpaqueWithMissingPath(u *dburl.URL) (string, error) { - return u.Opaque + genQueryOptions(u.Query()), nil -} - -func genQueryOptions(q url.Values) string { - if s := q.Encode(); s != "" { - return "?" + s - } - return "" -} - func killVectorContainer() error { if !common.ContainerExists(vectorContainerName) { return nil @@ -165,7 +109,7 @@ func stopVectorContainer() error { func valueToConfig(appName string, value string) (vectorSink, error) { var data vectorSink - u, err := dburl.Parse(value) + u, err := url.Parse(value) if err != nil { return data, err } diff --git a/plugins/logs/go.mod b/plugins/logs/go.mod index fda43da75..5f0bdacb7 100644 --- a/plugins/logs/go.mod +++ b/plugins/logs/go.mod @@ -3,13 +3,11 @@ module github.com/dokku/dokku/plugins/logs go 1.15 require ( - github.com/RaveNoX/go-jsonmerge v1.0.0 github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 github.com/dokku/dokku/plugins/common v0.0.0-00010101000000-000000000000 github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0 github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/xo/dburl v0.1.0 ) replace github.com/dokku/dokku/plugins/common => ../common diff --git a/plugins/logs/go.sum b/plugins/logs/go.sum index 77eb3234a..00274255e 100644 --- a/plugins/logs/go.sum +++ b/plugins/logs/go.sum @@ -1,24 +1,12 @@ -github.com/RaveNoX/go-jsoncommentstrip v1.0.0/go.mod h1:78ihd09MekBnJnxpICcwzCMzGrKSKYe4AqU6PDYYpjk= -github.com/RaveNoX/go-jsonmerge v1.0.0 h1:2e0nqnadoGUP8rAvcA0hkQelZreVO5X3BHomT2XMrAk= -github.com/RaveNoX/go-jsonmerge v1.0.0/go.mod h1:qYM/NA77LhO4h51JJM7Z+xBU3ovqrNIACZe+SkSNVFo= -github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27 h1:HHUr4P/aKh4quafGxDT9LDasjGdlGkzLbfmmrlng3kA= github.com/codeskyblue/go-sh v0.0.0-20190412065543-76bd3d59ff27/go.mod h1:VQx0hjo2oUeQkQUET7wRwradO6f+fN5jzXgB/zROxxE= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0 h1:ct2XA1aDw8A07Dr8gtrrZgIgLKcZNAl2o9nn0WRMK4Y= github.com/joncalhoun/qson v0.0.0-20200422171543-84433dcd3da0/go.mod h1:DFXrEwSRX0p/aSvxE21319menCBFeQO0jXpRj7LEZUA= -github.com/juju/gnuflag v0.0.0-20171113085948-2ce1bb71843d/go.mod h1:2PavIy+JPciBPrBUjwbNvtwB6RQlve+hkpll6QSNmOE= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3 h1:utdYOikI1XjNtTFGCwSM6OmFJblU4ld4gACoJsbadJg= github.com/ryanuber/columnize v1.1.2-0.20190319233515-9e6335e58db3/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad/go.mod h1:qLr4V1qq6nMqFKkMo8ZTx3f+BZEkzsRUY10Xsm2mwU0= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/xo/dburl v0.1.0 h1:WsW5ujxrapzhTflR4WoI+ZhynjE8T412ZWyoZtNNuJI= -github.com/xo/dburl v0.1.0/go.mod h1:TM8VMBT+LWqC3MBOulZjb8FAthcvZq0t/qvDLwS6skU= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a h1:DcqTD9SDLc+1P/r1EmRBwnVsrOwW+kk2vWf9n+1sGhs= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=