planetscale 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/pipeline.yml +21 -0
  3. data/.licenses/go/github.com/planetscale/planetscale-go/planetscale.dep.yml +56 -3
  4. data/.licenses/go/github.com/planetscale/sql-proxy/proxy.dep.yml +205 -172
  5. data/.licenses/go/go.uber.org/zap.dep.yml +1 -1
  6. data/.licenses/go/go.uber.org/zap/buffer.dep.yml +1 -1
  7. data/.licenses/go/go.uber.org/zap/internal/bufferpool.dep.yml +1 -1
  8. data/.licenses/go/go.uber.org/zap/internal/color.dep.yml +1 -1
  9. data/.licenses/go/go.uber.org/zap/internal/exit.dep.yml +1 -1
  10. data/.licenses/go/go.uber.org/zap/zapcore.dep.yml +1 -1
  11. data/README.md +8 -7
  12. data/controller.go +23 -10
  13. data/go.mod +3 -3
  14. data/go.sum +22 -23
  15. data/lib/generators/planetscale/install_generator.rb +5 -5
  16. data/lib/planetscale.rb +12 -12
  17. data/lib/planetscale/version.rb +1 -1
  18. data/planetscale.gemspec +1 -1
  19. data/proxy/planetscale-darwin.so +0 -0
  20. data/proxy/planetscale-linux.so +0 -0
  21. data/vendor/github.com/planetscale/planetscale-go/LICENSE +202 -0
  22. data/vendor/github.com/planetscale/planetscale-go/planetscale/audit_logs.go +136 -0
  23. data/vendor/github.com/planetscale/planetscale-go/planetscale/branches.go +5 -3
  24. data/vendor/github.com/planetscale/planetscale-go/planetscale/certs.go +40 -16
  25. data/vendor/github.com/planetscale/planetscale-go/planetscale/client.go +13 -6
  26. data/vendor/github.com/planetscale/planetscale-go/planetscale/databases.go +2 -0
  27. data/vendor/github.com/planetscale/planetscale-go/planetscale/regions.go +52 -0
  28. data/vendor/github.com/planetscale/planetscale-go/planetscale/service_tokens.go +1 -1
  29. data/vendor/github.com/planetscale/sql-proxy/LICENSE +202 -0
  30. data/vendor/github.com/planetscale/sql-proxy/proxy/client.go +17 -8
  31. data/vendor/go.uber.org/zap/CHANGELOG.md +60 -0
  32. data/vendor/go.uber.org/zap/CONTRIBUTING.md +0 -6
  33. data/vendor/go.uber.org/zap/FAQ.md +8 -0
  34. data/vendor/go.uber.org/zap/Makefile +13 -3
  35. data/vendor/go.uber.org/zap/README.md +4 -4
  36. data/vendor/go.uber.org/zap/buffer/buffer.go +18 -0
  37. data/vendor/go.uber.org/zap/field.go +10 -0
  38. data/vendor/go.uber.org/zap/go.mod +7 -6
  39. data/vendor/go.uber.org/zap/go.sum +25 -27
  40. data/vendor/go.uber.org/zap/http_handler.go +75 -24
  41. data/vendor/go.uber.org/zap/logger.go +11 -7
  42. data/vendor/go.uber.org/zap/options.go +8 -0
  43. data/vendor/go.uber.org/zap/sugar.go +21 -10
  44. data/vendor/go.uber.org/zap/zapcore/buffered_write_syncer.go +188 -0
  45. data/vendor/go.uber.org/zap/zapcore/clock.go +50 -0
  46. data/vendor/go.uber.org/zap/zapcore/console_encoder.go +1 -1
  47. data/vendor/go.uber.org/zap/zapcore/entry.go +2 -2
  48. data/vendor/go.uber.org/zap/zapcore/error.go +18 -1
  49. data/vendor/go.uber.org/zap/zapcore/field.go +7 -1
  50. data/vendor/go.uber.org/zap/zapcore/write_syncer.go +1 -2
  51. data/vendor/modules.txt +3 -3
  52. metadata +11 -5
  53. data/vendor/go.uber.org/zap/.travis.yml +0 -23
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: go.uber.org/zap
3
- version: v1.16.0
3
+ version: v1.18.1
4
4
  type: go
5
5
  summary: Package zap provides fast, structured, leveled logging.
6
6
  homepage: https://godoc.org/go.uber.org/zap
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: go.uber.org/zap/buffer
3
- version: v1.16.0
3
+ version: v1.18.1
4
4
  type: go
5
5
  summary: Package buffer provides a thin wrapper around a byte slice.
6
6
  homepage: https://godoc.org/go.uber.org/zap/buffer
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: go.uber.org/zap/internal/bufferpool
3
- version: v1.16.0
3
+ version: v1.18.1
4
4
  type: go
5
5
  summary: Package bufferpool houses zap's shared internal buffer pool.
6
6
  homepage: https://godoc.org/go.uber.org/zap/internal/bufferpool
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: go.uber.org/zap/internal/color
3
- version: v1.16.0
3
+ version: v1.18.1
4
4
  type: go
5
5
  summary: Package color adds coloring functionality for TTY output.
6
6
  homepage: https://godoc.org/go.uber.org/zap/internal/color
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: go.uber.org/zap/internal/exit
3
- version: v1.16.0
3
+ version: v1.18.1
4
4
  type: go
5
5
  summary: Package exit provides stubs so that unit tests can exercise code that calls
6
6
  os.Exit(1).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: go.uber.org/zap/zapcore
3
- version: v1.16.0
3
+ version: v1.18.1
4
4
  type: go
5
5
  summary: Package zapcore defines and implements the low-level interfaces upon which
6
6
  zap is built.
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # PlanetScale Ruby Client
2
+ [![Gem Version](https://badge.fury.io/rb/planetscale.svg)](https://rubygems.org/gems/planetscale)
2
3
 
3
4
  This Gem provides an easy to use client for connecting your Ruby application to PlanetScale. It handles setting up a local proxy that allows you to connect to any PlanetScale database and branch without reconfiguration, so that you can easily swap and choose using only environment variables.
4
5
 
@@ -43,7 +44,7 @@ development:
43
44
  database: <db_name>
44
45
  ```
45
46
 
46
- Now, your Rails app will boot the proxy as the app is starting, and connect to the `main` branch on your DB.
47
+ Now, your Rails app will boot the proxy as the app is starting, and connect to the `main` branch on your DB.
47
48
 
48
49
  ### Service Token Authentication
49
50
 
@@ -66,11 +67,11 @@ To use this Gem in 'production', we'll start by creating a PlanetScale Service T
66
67
  To configure your application in production, you'll need to feed it all of the right information via environment variables:
67
68
 
68
69
  ```
69
- PSCALE_ORG=<org_name>
70
- PSCALE_DB=<db_name>
71
- PSCALE_DB_BRANCH=main
72
- PSCALE_TOKEN_NAME=0sph6kvz5bxi
73
- PSCALE_TOKEN=<redacted>
70
+ PLANETSCALE_ORG=<org_name>
71
+ PLANETSCALE_DB=<db_name>
72
+ PLANETSCALE_DB_BRANCH=main
73
+ PLANETSCALE_TOKEN_NAME=0sph6kvz5bxi
74
+ PLANETSCALE_TOKEN=<redacted>
74
75
  ```
75
76
 
76
77
  ## Development
@@ -85,4 +86,4 @@ Bug reports and pull requests are welcome. This Gem is internal to PlanetScale c
85
86
 
86
87
  ## License
87
88
 
88
- Currently this Gem is specified under the MIT license, however it has not been made public. Care will be taken before this is done to choose an appropriate license.
89
+ Currently this Gem is specified under the MIT license, however it has not been made public. Care will be taken before this is done to choose an appropriate license.
data/controller.go CHANGED
@@ -2,8 +2,9 @@ package main
2
2
 
3
3
  import (
4
4
  "context"
5
+ "crypto/ecdsa"
6
+ "crypto/elliptic"
5
7
  "crypto/rand"
6
- "crypto/rsa"
7
8
  "crypto/tls"
8
9
  "crypto/x509"
9
10
  "encoding/pem"
@@ -174,7 +175,7 @@ func newRemoteCertSource(client *planetscale.Client) *remoteCertSource {
174
175
  }
175
176
 
176
177
  func (r *remoteCertSource) Cert(ctx context.Context, org, db, branch string) (*proxy.Cert, error) {
177
- pkey, err := rsa.GenerateKey(rand.Reader, 2048)
178
+ pkey, err := ecdsa.GenerateKey(elliptic.P256(), rand.Reader)
178
179
  if err != nil {
179
180
  return nil, fmt.Errorf("couldn't generate private key: %s", err)
180
181
  }
@@ -191,7 +192,7 @@ func (r *remoteCertSource) Cert(ctx context.Context, org, db, branch string) (*p
191
192
 
192
193
  return &proxy.Cert{
193
194
  ClientCert: cert.ClientCert,
194
- CACert: cert.CACert,
195
+ CACerts: cert.CACerts,
195
196
  RemoteAddr: cert.RemoteAddr,
196
197
  Ports: proxy.RemotePorts{
197
198
  Proxy: cert.Ports.Proxy,
@@ -213,7 +214,7 @@ func (l *localCertSource) Cert(ctx context.Context, org, db, branch string) (*pr
213
214
  return nil, err
214
215
  }
215
216
 
216
- caCert, err := parseCert(l.certChain)
217
+ caCert, err := parseCerts(l.certChain)
217
218
  if err != nil {
218
219
  return nil, err
219
220
  }
@@ -225,7 +226,7 @@ func (l *localCertSource) Cert(ctx context.Context, org, db, branch string) (*pr
225
226
 
226
227
  return &proxy.Cert{
227
228
  ClientCert: clientCert,
228
- CACert: caCert,
229
+ CACerts: caCert,
229
230
  RemoteAddr: l.remoteAddr,
230
231
  Ports: proxy.RemotePorts{
231
232
  Proxy: port,
@@ -246,10 +247,22 @@ func logHandler(l *zap.Logger) func(http.Handler) http.Handler {
246
247
  }
247
248
  }
248
249
 
249
- func parseCert(pemCert string) (*x509.Certificate, error) {
250
- bl, _ := pem.Decode([]byte(pemCert))
251
- if bl == nil {
252
- return nil, errors.New("invalid PEM: " + pemCert)
250
+ func parseCerts(pemCert string) ([]*x509.Certificate, error) {
251
+ perCertBlock := []byte(pemCert)
252
+ var certs []*x509.Certificate
253
+
254
+ for {
255
+ var certBlock *pem.Block
256
+ certBlock, perCertBlock = pem.Decode(perCertBlock)
257
+ if certBlock == nil {
258
+ break
259
+ }
260
+ cert, err := x509.ParseCertificate(certBlock.Bytes)
261
+ if err != nil {
262
+ return nil, err
263
+ }
264
+
265
+ certs = append(certs, cert)
253
266
  }
254
- return x509.ParseCertificate(bl.Bytes)
267
+ return certs, nil
255
268
  }
data/go.mod CHANGED
@@ -7,9 +7,9 @@ require (
7
7
  github.com/golang/protobuf v1.5.2 // indirect
8
8
  github.com/gorilla/mux v1.8.0
9
9
  github.com/mitchellh/go-homedir v1.1.0
10
- github.com/planetscale/planetscale-go v0.25.0
11
- github.com/planetscale/sql-proxy v0.3.2
12
- go.uber.org/zap v1.16.0
10
+ github.com/planetscale/planetscale-go v0.36.0
11
+ github.com/planetscale/sql-proxy v0.8.0
12
+ go.uber.org/zap v1.18.1
13
13
  golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1 // indirect
14
14
  golang.org/x/oauth2 v0.0.0-20210413134643-5e61552d6c78 // indirect
15
15
  google.golang.org/appengine v1.6.7 // indirect
data/go.sum CHANGED
@@ -31,11 +31,12 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl
31
31
  cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs=
32
32
  cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
33
33
  dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
34
- github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
35
34
  github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
36
35
  github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
37
36
  github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2 h1:7Ip0wMmLHLRJdrloDxZfhMm0xrLXZS8+COSu2bXmEQs=
38
37
  github.com/armon/circbuf v0.0.0-20190214190532-5111143e8da2/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
38
+ github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8=
39
+ github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
39
40
  github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
40
41
  github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
41
42
  github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
@@ -49,12 +50,12 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
49
50
  github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
50
51
  github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
51
52
  github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
52
- github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k=
53
- github.com/frankban/quicktest v1.12.1 h1:P6vQcHwZYgVGIpUzKB5DXzkEeYJppJOStPLuh9aB89c=
54
- github.com/frankban/quicktest v1.12.1/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU=
53
+ github.com/frankban/quicktest v1.13.0 h1:yNZif1OkDfNoDfb9zZa9aXIpejNR4F23Wely0c+Qdqk=
54
+ github.com/frankban/quicktest v1.13.0/go.mod h1:qLE0fzW0VuyUAJgPU19zByoIr0HtCHN/r/VLSOOIySU=
55
55
  github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
56
56
  github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
57
57
  github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
58
+ github.com/go-sql-driver/mysql v1.6.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
58
59
  github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
59
60
  github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
60
61
  github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -92,9 +93,9 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
92
93
  github.com/google/go-cmp v0.4.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
93
94
  github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
94
95
  github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
95
- github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
96
- github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
97
96
  github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
97
+ github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
98
+ github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
98
99
  github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
99
100
  github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
100
101
  github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -128,11 +129,11 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
128
129
  github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
129
130
  github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
130
131
  github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
131
- github.com/planetscale/planetscale-go v0.18.0/go.mod h1:R+07GStW2oGSfeTwWoplnimSEFzxIzEofOHgPFxArg0=
132
- github.com/planetscale/planetscale-go v0.25.0 h1:pdoIx1etSy24R/msOqezxOpV1rXNll6VDmuUC5LdjGc=
133
- github.com/planetscale/planetscale-go v0.25.0/go.mod h1:6J6w0t3GSeM/Etb5x2Fc7kEbA9M9rW2PY3h1y5Mc8Ew=
134
- github.com/planetscale/sql-proxy v0.3.2 h1:S0X8nvyk8Mr7I/t0LjpH4e2XNoBB+azK934dK4EvYWU=
135
- github.com/planetscale/sql-proxy v0.3.2/go.mod h1:kM7r4GMseGJ1UP1F96PEPPCvEYM3Npqp0WDvtmYTZtk=
132
+ github.com/planetscale/planetscale-go v0.33.0/go.mod h1:99n+tnrvJaaUako3UZNCiC1dTtSPKr81GqAUNibw5pc=
133
+ github.com/planetscale/planetscale-go v0.36.0 h1:voNRDQ7FgbpuVJKlLZm6QgIByp0UnvyRtGmVZWQlSZY=
134
+ github.com/planetscale/planetscale-go v0.36.0/go.mod h1:99n+tnrvJaaUako3UZNCiC1dTtSPKr81GqAUNibw5pc=
135
+ github.com/planetscale/sql-proxy v0.8.0 h1:EeWQhocldn0ldrTxPIIIrbHWWqNqHrNFYiSdp4tUY0E=
136
+ github.com/planetscale/sql-proxy v0.8.0/go.mod h1:vOcL5jRMzaza+8q79hRRhMj3ABpYHy3cgenr2FOhDWU=
136
137
  github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
137
138
  github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
138
139
  github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
@@ -140,8 +141,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR
140
141
  github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
141
142
  github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
142
143
  github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
143
- github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
144
- github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
144
+ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
145
+ github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
145
146
  github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
146
147
  github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
147
148
  github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
@@ -150,15 +151,14 @@ go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
150
151
  go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
151
152
  go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
152
153
  go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
153
- go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
154
154
  go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
155
155
  go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
156
- go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
156
+ go.uber.org/goleak v1.1.10 h1:z+mqJhf6ss6BSfSM671tgKyZBFPTTJM+HLxnhPC3wu0=
157
+ go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
157
158
  go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
158
159
  go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
159
- go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
160
- go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM=
161
- go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ=
160
+ go.uber.org/zap v1.18.1 h1:CSUJ2mjFszzEWt4CdKISEuChVIXGBn3lAPwkRGyVrc4=
161
+ go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
162
162
  golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
163
163
  golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
164
164
  golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
@@ -293,8 +293,7 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw
293
293
  golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
294
294
  golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
295
295
  golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
296
- golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
297
- golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
296
+ golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
298
297
  golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
299
298
  golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
300
299
  golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
@@ -410,18 +409,18 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogR
410
409
  gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
411
410
  gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
412
411
  gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
412
+ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
413
413
  gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
414
414
  gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
415
415
  gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
416
- gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 h1:tQIYjPdBoyREyB9XMu+nnTclpTYkz2zFM+lzLJFO4gQ=
417
- gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
416
+ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
417
+ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
418
418
  honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
419
419
  honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
420
420
  honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
421
421
  honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
422
422
  honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
423
423
  honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
424
- honnef.co/go/tools v0.0.1-2020.1.4 h1:UoveltGrhghAA7ePc+e+QYDHXrBps2PqFZiHkGR/xK8=
425
424
  honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
426
425
  rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8=
427
426
  rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
@@ -1,12 +1,12 @@
1
1
  require 'rails/generators'
2
2
 
3
3
  class Planetscale
4
- class InstallGenerator < Rails::Generators::Base
4
+ class InstallGenerator < Rails::Generators::Base
5
5
  class_option :organization, type: :string, default: ''
6
6
 
7
7
  def read_config
8
8
  @database = "<db_name>"
9
- file_path = File.join(Rails.root, PlanetScale::Proxy::PSCALE_FILE)
9
+ file_path = File.join(Rails.root, PlanetScale::Proxy::PLANETSCALE_FILE)
10
10
  return unless File.exist?(file_path)
11
11
 
12
12
  data = YAML.safe_load(File.read(file_path))
@@ -21,7 +21,7 @@ class Planetscale
21
21
  end
22
22
 
23
23
  @org ||= options[:organization]
24
- end
24
+ end
25
25
 
26
26
  APPLICATION_REQUIRE_REGEX = /(require_relative ("|')application("|')\n)/.freeze
27
27
 
@@ -34,7 +34,7 @@ class Planetscale
34
34
  end
35
35
 
36
36
  # todo(nickvanw): When we get rid of DB passwords, this can mostly go away, and we can just
37
- # return the `DATABSE_URL` that the user should use.
37
+ # return the `DATABSE_URL` that the user should use.
38
38
  def print_database_yaml
39
39
  d =
40
40
  <<~EOS
@@ -52,7 +52,7 @@ class Planetscale
52
52
  puts d
53
53
  puts "\nOr set DATABASE_URL=#{db_url}"
54
54
  end
55
- end
55
+ end
56
56
  end
57
57
 
58
58
  class String
data/lib/planetscale.rb CHANGED
@@ -13,10 +13,10 @@ module PlanetScale
13
13
 
14
14
  class Proxy
15
15
  AUTH_SERVICE_TOKEN = 1 # Use Service Tokens for Auth
16
- AUTH_PSCALE = 2 # Use externally configured `pscale` auth & org config
16
+ AUTH_PLANETSCALE = 2 # Use externally configured `pscale` auth & org config
17
17
  AUTH_STATIC = 3 # Use a locally provided certificate
18
18
  AUTH_AUTO = 4 # Default. Let the Gem figure it out
19
- PSCALE_FILE = '.pscale.yml'
19
+ PLANETSCALE_FILE = '.pscale.yml'
20
20
 
21
21
  class ProxyError < StandardError
22
22
  end
@@ -36,26 +36,26 @@ module PlanetScale
36
36
  @auth_method = auth_method
37
37
 
38
38
  default_file = if defined?(Rails.root)
39
- File.join(Rails.root, PSCALE_FILE) if defined?(Rails.root)
39
+ File.join(Rails.root, PLANETSCALE_FILE) if defined?(Rails.root)
40
40
  else
41
- PSCALE_FILE
41
+ PLANETSCALE_FILE
42
42
  end
43
43
 
44
- @cfg_file = kwargs[:cfg_file] || ENV['PSCALE_DB_CONFIG'] || default_file
44
+ @cfg_file = kwargs[:cfg_file] || ENV['PLANETSCALE_DB_CONFIG'] || default_file
45
45
 
46
- @branch_name = kwargs[:branch] || ENV['PSCALE_DB_BRANCH']
46
+ @branch_name = kwargs[:branch] || ENV['PLANETSCALE_DB_BRANCH']
47
47
  @branch = lookup_branch
48
48
 
49
- @db_name = kwargs[:db] || ENV['PSCALE_DB']
49
+ @db_name = kwargs[:db] || ENV['PLANETSCALE_DB']
50
50
  @db = lookup_database
51
51
 
52
- @org_name = kwargs[:org] || ENV['PSCALE_ORG']
52
+ @org_name = kwargs[:org] || ENV['PLANETSCALE_ORG']
53
53
  @org = lookup_org
54
54
 
55
55
  raise ArgumentError, 'missing required configuration variables' if [@db, @branch, @org].any?(&:nil?)
56
56
 
57
- @token_name = kwargs[:token_id] || ENV['PSCALE_TOKEN_NAME']
58
- @token = kwargs[:token] || ENV['PSCALE_TOKEN']
57
+ @token_name = kwargs[:token_id] || ENV['PLANETSCALE_TOKEN_NAME']
58
+ @token = kwargs[:token] || ENV['PLANETSCALE_TOKEN']
59
59
 
60
60
  if @token && @token_name && auto_auth?
61
61
  @auth_method = AUTH_SERVICE_TOKEN
@@ -78,7 +78,7 @@ module PlanetScale
78
78
 
79
79
  def start
80
80
  ret = case @auth_method
81
- when AUTH_PSCALE
81
+ when AUTH_PLANETSCALE
82
82
  startfromenv(@org, @db, @branch, @listen_addr)
83
83
  when AUTH_AUTO
84
84
  startfromenv(@org, @db, @branch, @listen_addr)
@@ -123,7 +123,7 @@ module PlanetScale
123
123
  end
124
124
 
125
125
  def env_auth?
126
- @auth_method == AUTH_PSCALE
126
+ @auth_method == AUTH_PLANETSCALE
127
127
  end
128
128
 
129
129
  def token_auth?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PlanetScale
4
- VERSION = '0.2.1'
4
+ VERSION = '0.3.0'
5
5
  end
data/planetscale.gemspec CHANGED
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ['lib']
37
37
 
38
- spec.add_development_dependency 'bundler', '~> 2.2'
38
+ spec.add_development_dependency 'bundler', '~> 2'
39
39
  spec.add_development_dependency 'rake', '>= 12.3.3'
40
40
  spec.add_development_dependency 'pry'
41
41
  spec.add_development_dependency 'minitest'
Binary file
Binary file
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2021 PlanetScale, Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.