├── .DS_Store
├── .github
└── workflows
│ └── k8-deploy.yml
├── .gitignore
├── LICENSE
├── README.md
├── backend.Dockerfile
├── backend
├── .gitignore
├── auth
│ ├── JwtAuth.go
│ └── Oauth.go
├── go.mod
├── go.sum
├── main.go
├── middleware
│ └── handlers.go
├── models
│ └── models.go
└── utils
│ ├── crud.go
│ ├── getEnv.go
│ ├── gist.go
│ └── parser.go
├── dev-startup.sh
├── docker-compose.yaml
├── frontend.Dockerfile
├── frontend
├── .DS_Store
├── .env.dev
├── .env.prod
├── .gitignore
├── package.json
├── public
│ ├── .DS_Store
│ ├── index.html
│ ├── manifest.json
│ └── sf.png
├── server.js
├── src
│ ├── App.js
│ ├── components
│ │ ├── Footer
│ │ │ └── index.js
│ │ ├── GistTable
│ │ │ └── index.js
│ │ ├── NavBar
│ │ │ ├── ResponsiveAntMenu.js
│ │ │ └── index.js
│ │ └── UploadGist
│ │ │ └── index.js
│ ├── index.js
│ ├── pages
│ │ ├── Dashboard.js
│ │ └── Login.js
│ └── redux
│ │ ├── actionTypes.js
│ │ ├── actions.js
│ │ ├── reducers
│ │ ├── gistifyReducer.js
│ │ └── index.js
│ │ └── store.js
└── yarn.lock
├── helm
├── Chart.yaml
├── templates
│ ├── gistify-backend
│ │ ├── deployment.yaml
│ │ ├── ingress.yaml
│ │ ├── secrets.yaml
│ │ └── service.yaml
│ ├── gistify-frontend
│ │ ├── deployment.yaml
│ │ ├── ingress.yaml
│ │ └── service.yaml
│ └── postgres
│ │ ├── service.yaml
│ │ └── statefulset.yaml
└── values.yaml
├── sonar-project.properties
└── test_docs
├── .DS_Store
├── dev-salaries.csv
├── dev-salaries.xlsx
├── docker-compose.yaml
└── traefik.toml
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dineshsonachalam/gistify/511f241251c1395899c80baf8d30eeaa777894bc/.DS_Store
--------------------------------------------------------------------------------
/.github/workflows/k8-deploy.yml:
--------------------------------------------------------------------------------
1 | name: Docker
2 |
3 | on:
4 | push:
5 | branches:
6 | - '**' # matches every branch
7 |
8 | jobs:
9 | sonarcloud:
10 | name: SonarCloud
11 | runs-on: ubuntu-latest
12 | steps:
13 | - uses: actions/checkout@v2
14 | with:
15 | fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
16 | - name: SonarCloud Scan
17 | uses: SonarSource/sonarcloud-github-action@master
18 | env:
19 | GITHUB_TOKEN: ${{ github.token }} # Needed to get PR information, if any
20 | SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
21 |
22 | upload-docker-image:
23 | needs: sonarcloud
24 | runs-on: ubuntu-latest
25 | if: github.event_name == 'push'
26 | steps:
27 | - uses: actions/checkout@v2
28 |
29 | - name: Build backend and frontend image
30 | run: |
31 | npm i --prefix frontend
32 | npm run build --prefix frontend
33 | docker build --no-cache -t dineshsonachalam/gistify-backend:latest -f backend.Dockerfile .
34 | docker build --no-cache -t dineshsonachalam/gistify-frontend:latest -f frontend.Dockerfile .
35 |
36 | - name: Log into registry
37 | run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
38 |
39 | - name: Push image
40 | run: |
41 | docker push dineshsonachalam/gistify-backend:latest
42 | docker push dineshsonachalam/gistify-frontend:latest
43 |
44 | deploy-to-k8-cluster:
45 | needs: upload-docker-image
46 | runs-on: ubuntu-latest
47 | steps:
48 | - uses: actions/checkout@master
49 | - name: Backend deployment rolling restart to fetch recently build docker image from docker hub.
50 | uses: steebchen/kubectl@master
51 | env:
52 | KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
53 | with:
54 | args: rollout restart deployment gistify-api -n=dinesh
55 |
56 | - name: Verify deployment for Backend app
57 | uses: steebchen/kubectl@master
58 | env:
59 | KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
60 | KUBECTL_VERSION: "1.15"
61 | with:
62 | args: rollout status deployment/gistify-api -n=dinesh
63 |
64 | - name: Frontend deployment rolling restart to fetch recently build docker image from docker hub.
65 | uses: steebchen/kubectl@master
66 | env:
67 | KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
68 | with:
69 | args: rollout restart deployment gistify-ui -n=dinesh
70 |
71 | - name: Verify deployment for Frontend app
72 | uses: steebchen/kubectl@master
73 | env:
74 | KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
75 | KUBECTL_VERSION: "1.15"
76 | with:
77 | args: rollout status deployment/gistify-ui -n=dinesh
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Binaries for programs and plugins
2 | *.exe
3 | *.exe~
4 | *.dll
5 | *.so
6 | *.dylib
7 |
8 | # Test binary, built with `go test -c`
9 | *.test
10 |
11 | # Output of the go coverage tool, specifically when used with LiteIDE
12 | *.out
13 |
14 | # Dependency directories (remove the comment below to include it)
15 | vendor/
16 |
17 | # Dependency directories
18 | data/
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Dinesh Sonachalam
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Powered by Go, PostgreSQL, React, Redux, Kubernetes, Cypress E2E and Github CI/CD
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 | ## Demo
22 | 1. Live demo
23 | 2. Video demo
24 |
25 | ## What's this project all about?
26 |
27 | This project showcases how to build a Go parser that converts (almost) anything(YAML, TOML, CSV, and EXCEL) to JSON and upload it to Github Gist. We focus on the following aspects as part of this project.
28 |
29 | - [x] 1. Build an efficient Golang parser that takes (YAML/TOML/CSV/EXCEL) file as an input and converting it to JSON.
30 | - [x] 2. Build a Golang API service with JWT support using Golang's Gin framework and authenticate users using Github Oauth.
31 | - [x] 3. Take the converted JSON by Golang parser and upload it to Github Gist.
32 | - [x] 4. Build UI using React and Redux.
33 | - [x] 5. Deployment using Kubernetes.
34 |
35 | ## Start the application
36 |
37 | 1. Register a new Github OAuth application - https://github.com/settings/applications/new
38 |
39 |
40 | 2. Get the Github Client ID and Client Secret.
41 |
42 |
43 | 3. Create a new Github access token with Gist Write permissions - https://github.com/settings/tokens
44 |
45 |
46 | 4. Update the Github client ID in your React applications .env.dev file.
47 |
48 | ```
49 | dineshsonachalam@macbook gistify % cat frontend/.env.dev
50 | REACT_APP_API_ENDPOINT = "http://localhost:8003"
51 | REACT_APP_GITHUB_CLIENT_ID = "21c29d28ab59b778a8bd"
52 | REACT_APP_COOKIE_DOMAIN = "localhost"
53 | ```
54 |
55 | 5. Set the following environment variables with Github client ID, Github client secret, Github API token, and JWT secret key.
56 |
57 | ```
58 | export GISTIFY_APP_ENV="DEV"
59 | export GISTIFY_DEV_APP_URL="http://localhost:3000/"
60 | export GISTIFY_DEV_GITHUB_CLIENT_ID=""
61 | export GISTIFY_DEV_GITHUB_CLIENT_SECRET=""
62 | export GISTIFY_DEV_JWT_SECRET_KEY=""
63 | export GISTIFY_DEV_GIST_API_TOKEN=""
64 | ```
65 |
66 | 6. Start the Postgres container.
67 | ```
68 | docker-compose up
69 | ```
70 |
71 | 7. Start the React app.
72 | ```
73 | cd frontend && npm run start
74 | ```
75 |
76 | 8. Start the Backend app.
77 | ```
78 | cd backend && go run main.go
79 | ```
80 |
81 |
82 |
83 | ## License
84 |
85 | [MIT](https://choosealicense.com/licenses/mit/) © [dineshsonachalam](https://www.github.com/dineshsonachalam)
86 |
--------------------------------------------------------------------------------
/backend.Dockerfile:
--------------------------------------------------------------------------------
1 | FROM golang:rc-buster
2 |
3 | WORKDIR /go/src/app
4 |
5 | COPY backend .
6 |
7 | ENV PORT=8003
8 |
9 | EXPOSE $PORT
10 |
11 | RUN go build main.go
12 |
13 | CMD ["./main"]
14 |
15 |
--------------------------------------------------------------------------------
/backend/.gitignore:
--------------------------------------------------------------------------------
1 | # Binaries for programs and plugins
2 | *.exe
3 | *.exe~
4 | *.dll
5 | *.so
6 | *.dylib
7 |
8 | # Test binary, built with `go test -c`
9 | *.test
10 |
11 | # Output of the go coverage tool, specifically when used with LiteIDE
12 | *.out
13 |
14 | # Dependency directories (remove the comment below to include it)
15 | vendor/
--------------------------------------------------------------------------------
/backend/auth/JwtAuth.go:
--------------------------------------------------------------------------------
1 | package auth
2 |
3 | import (
4 | "encoding/json"
5 | "time"
6 |
7 | "github.com/dgrijalva/jwt-go"
8 | )
9 |
10 | // JwtPayload represents JWT Payload which is used, to create and validate JWT
11 | type JwtPayload struct {
12 | Id string `json:"id"`
13 | Username string `json:"username"`
14 | jwt.StandardClaims
15 | }
16 |
17 | // CreateJwtAccessToken return JWT access token
18 | func CreateJwtAccessToken(payload map[string]string, jwtSecretKey []byte) string {
19 | // Step 1: Token expiration time - 15 minutes
20 | tokenExpirationTime := time.Now().Add(15 * time.Minute)
21 | // Step 2: Create JWT payload, which includes the
22 | // id, username, and token expiration time
23 | jwtPayload := &JwtPayload{
24 | Id: payload["id"],
25 | Username: payload["username"],
26 | StandardClaims: jwt.StandardClaims{
27 | // In JWT, the expiry time is expressed as unix milliseconds
28 | ExpiresAt: tokenExpirationTime.Unix(),
29 | },
30 | }
31 | // Step 3: Declare the JWT token with algorithm used for signing
32 | // and the payload
33 | token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwtPayload)
34 | // Step 4: Create the JWT access token
35 | jwtAccessToken, _ := token.SignedString(jwtSecretKey)
36 | return jwtAccessToken
37 | }
38 |
39 | // ValidateJwtAccessToken return the JWT access token validation status
40 | func ValidateJwtAccessToken(jwtAccessToken string, jwtSecretKey []byte) bool {
41 | // Step 1: Initialize a new instance of JwtPayload
42 | jwtPayload := &JwtPayload{}
43 | // Step 2: JWT Token ..
44 | // Compute signature using Header + Payload using JWT secret key.
45 | // Then comparing generated signature with computed signature.
46 | // If two signature matches, token is valid else invalid.
47 | jwtToken, err := jwt.ParseWithClaims(jwtAccessToken, jwtPayload, func(token *jwt.Token) (interface{}, error) {
48 | return jwtSecretKey, nil
49 | })
50 | if err != nil || !jwtToken.Valid {
51 | return false
52 | }
53 | return true
54 | }
55 |
56 | // IsJwtAccessTokenExpiryInFiveMin return the status of JWT access token expiry is within 5 minutes.
57 | func IsJwtAccessTokenExpiryInFiveMin(jwtAccessToken string) (bool, string, string) {
58 | token, _, err := new(jwt.Parser).ParseUnverified(jwtAccessToken, jwt.MapClaims{})
59 | if err != nil {
60 | return false, "", ""
61 | }
62 | jwtPayload, ok := token.Claims.(jwt.MapClaims)
63 | if !ok {
64 | return false, "", ""
65 | }
66 | var tokenExpirationTime time.Time
67 | id := jwtPayload["id"].(string)
68 | username := jwtPayload["username"].(string)
69 | switch exp := jwtPayload["exp"].(type) {
70 | case float64:
71 | tokenExpirationTime = time.Unix(int64(exp), 0)
72 | case json.Number:
73 | v, _ := exp.Int64()
74 | tokenExpirationTime = time.Unix(v, 0)
75 | }
76 | currentTime := time.Now().Add(5 * time.Minute)
77 | if tokenExpirationTime.Before(currentTime) {
78 | return true, id, username
79 | }
80 | return false, id, username
81 | }
82 |
--------------------------------------------------------------------------------
/backend/auth/Oauth.go:
--------------------------------------------------------------------------------
1 | package auth
2 |
3 | import (
4 | "fmt"
5 | "gistify/utils"
6 | "strconv"
7 | "strings"
8 | )
9 |
10 | // GithubUserInfo represent authenticated Github user information
11 | type GithubUserInfo struct {
12 | Id string `json:"id"`
13 | Username string `json:"username"`
14 | Email string ` json:"email"`
15 | }
16 |
17 | // GithubUserDetails return authenticated Github user information
18 | func GithubUserDetails(clientId string, clientSecret string, requestToken string) GithubUserInfo {
19 | accessTokenURL := fmt.Sprintf("https://github.com/login/oauth/access_token?client_id=%s&client_secret=%s&code=%s", clientId, clientSecret, requestToken)
20 | payload := strings.NewReader(`{}`)
21 | headers := map[string]string{
22 | "accept": "application/json",
23 | }
24 | AccessTokenResponse := utils.Request("POST", accessTokenURL, payload, headers)
25 | if AccessTokenResponse.Status {
26 | accessToken := AccessTokenResponse.ResponseBody["access_token"]
27 | githubUserDetailsUrl := "https://api.github.com/user"
28 | payload := strings.NewReader(`{}`)
29 | headers := map[string]string{
30 | "Authorization": fmt.Sprintf("Bearer %s", accessToken),
31 | }
32 | GithubUserDetailsResponse := utils.Request("GET", githubUserDetailsUrl, payload, headers)
33 | if GithubUserDetailsResponse.Status {
34 | githubUserId := int(GithubUserDetailsResponse.ResponseBody["id"].(float64))
35 | githubUsername := GithubUserDetailsResponse.ResponseBody["login"].(string)
36 | githubUserEmail := GithubUserDetailsResponse.ResponseBody["email"].(string)
37 | id := strconv.Itoa(githubUserId)
38 | username := githubUsername
39 | email := githubUserEmail
40 | return GithubUserInfo{id, username, email}
41 | }
42 | }
43 | return GithubUserInfo{}
44 | }
45 |
--------------------------------------------------------------------------------
/backend/go.mod:
--------------------------------------------------------------------------------
1 | module gistify
2 |
3 | go 1.16
4 |
5 | require (
6 | github.com/dgrijalva/jwt-go v3.2.0+incompatible
7 | github.com/gin-gonic/gin v1.7.1
8 | github.com/go-playground/validator/v10 v10.6.1 // indirect
9 | github.com/golang/protobuf v1.5.2 // indirect
10 | github.com/jackc/pgx/v4 v4.11.0
11 | github.com/json-iterator/go v1.1.11 // indirect
12 | github.com/leodido/go-urn v1.2.1 // indirect
13 | github.com/pelletier/go-toml v1.9.1
14 | github.com/tealeg/xlsx v1.0.5
15 | github.com/ugorji/go v1.2.6 // indirect
16 | golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
17 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
18 | golang.org/x/text v0.3.6 // indirect
19 | gopkg.in/yaml.v2 v2.4.0 // indirect
20 | sigs.k8s.io/yaml v1.2.0
21 | )
22 |
--------------------------------------------------------------------------------
/backend/go.sum:
--------------------------------------------------------------------------------
1 | cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
2 | cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
3 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
4 | github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
5 | github.com/Masterminds/semver/v3 v3.1.1/go.mod h1:VPu/7SZ7ePZ3QOrcuXROw5FAcLl4a0cBrbBpGY/8hQs=
6 | github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
7 | github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI=
8 | github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
9 | github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
10 | github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
11 | github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
12 | github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
13 | github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
14 | github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
15 | github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
16 | github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
17 | github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
18 | github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
19 | github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A=
20 | github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
21 | github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
22 | github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
23 | github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
24 | github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
25 | github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
26 | github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
27 | github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
28 | github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
29 | github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
30 | github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
31 | github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE=
32 | github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
33 | github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
34 | github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
35 | github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8=
36 | github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI=
37 | github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
38 | github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
39 | github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
40 | github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
41 | github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
42 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
43 | github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
44 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
45 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
46 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
47 | github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
48 | github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
49 | github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
50 | github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs=
51 | github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
52 | github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I=
53 | github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
54 | github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g=
55 | github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
56 | github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
57 | github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
58 | github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4=
59 | github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20=
60 | github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
61 | github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
62 | github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
63 | github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
64 | github.com/gin-gonic/gin v1.7.1 h1:qC89GU3p8TvKWMAVhEpmpB2CIb1hnqt2UdKZaP93mS8=
65 | github.com/gin-gonic/gin v1.7.1/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
66 | github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
67 | github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
68 | github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o=
69 | github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
70 | github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
71 | github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
72 | github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
73 | github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
74 | github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
75 | github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
76 | github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
77 | github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
78 | github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
79 | github.com/go-playground/validator/v10 v10.6.1 h1:W6TRDXt4WcWp4c4nf/G+6BkGdhiIo0k417gfr+V6u4I=
80 | github.com/go-playground/validator/v10 v10.6.1/go.mod h1:xm76BBt941f7yWdGnI2DVPFFg1UK3YY04qifoXU3lOk=
81 | github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
82 | github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
83 | github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
84 | github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
85 | github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s=
86 | github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
87 | github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
88 | github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
89 | github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
90 | github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
91 | github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
92 | github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
93 | github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
94 | github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
95 | github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
96 | github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
97 | github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
98 | github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
99 | github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
100 | github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
101 | github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
102 | github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
103 | github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
104 | github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
105 | github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
106 | github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
107 | github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
108 | github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
109 | github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
110 | github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
111 | github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
112 | github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg=
113 | github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
114 | github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
115 | github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
116 | github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
117 | github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
118 | github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
119 | github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
120 | github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
121 | github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
122 | github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
123 | github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
124 | github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
125 | github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
126 | github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU=
127 | github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
128 | github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
129 | github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
130 | github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
131 | github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
132 | github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90=
133 | github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
134 | github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
135 | github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
136 | github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ=
137 | github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
138 | github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
139 | github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
140 | github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg=
141 | github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
142 | github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
143 | github.com/jackc/chunkreader v1.0.0 h1:4s39bBR8ByfqH+DKm8rQA3E1LHZWB9XWcrz8fqaZbe0=
144 | github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo=
145 | github.com/jackc/chunkreader/v2 v2.0.0/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
146 | github.com/jackc/chunkreader/v2 v2.0.1 h1:i+RDz65UE+mmpjTfyz0MoVTnzeYxroil2G82ki7MGG8=
147 | github.com/jackc/chunkreader/v2 v2.0.1/go.mod h1:odVSm741yZoC3dpHEUXIqA9tQRhFrgOHwnPIn9lDKlk=
148 | github.com/jackc/pgconn v0.0.0-20190420214824-7e0022ef6ba3/go.mod h1:jkELnwuX+w9qN5YIfX0fl88Ehu4XC3keFuOJJk9pcnA=
149 | github.com/jackc/pgconn v0.0.0-20190824142844-760dd75542eb/go.mod h1:lLjNuW/+OfW9/pnVKPazfWOgNfH2aPem8YQ7ilXGvJE=
150 | github.com/jackc/pgconn v0.0.0-20190831204454-2fabfa3c18b7/go.mod h1:ZJKsE/KZfsUgOEh9hBm+xYTstcNHg7UPMVJqRfQxq4s=
151 | github.com/jackc/pgconn v1.4.0/go.mod h1:Y2O3ZDF0q4mMacyWV3AstPJpeHXWGEetiFttmq5lahk=
152 | github.com/jackc/pgconn v1.5.0/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI=
153 | github.com/jackc/pgconn v1.5.1-0.20200601181101-fa742c524853/go.mod h1:QeD3lBfpTFe8WUnPZWN5KY/mB8FGMIYRdd8P8Jr0fAI=
154 | github.com/jackc/pgconn v1.8.1 h1:ySBX7Q87vOMqKU2bbmKbUvtYhauDFclYbNDYIE1/h6s=
155 | github.com/jackc/pgconn v1.8.1/go.mod h1:JV6m6b6jhjdmzchES0drzCcYcAHS1OPD5xu3OZ/lE2g=
156 | github.com/jackc/pgio v1.0.0 h1:g12B9UwVnzGhueNavwioyEEpAmqMe1E/BN9ES+8ovkE=
157 | github.com/jackc/pgio v1.0.0/go.mod h1:oP+2QK2wFfUWgr+gxjoBH9KGBb31Eio69xUb0w5bYf8=
158 | github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2 h1:JVX6jT/XfzNqIjye4717ITLaNwV9mWbJx0dLCpcRzdA=
159 | github.com/jackc/pgmock v0.0.0-20190831213851-13a1b77aafa2/go.mod h1:fGZlG77KXmcq05nJLRkk0+p82V8B8Dw8KN2/V9c/OAE=
160 | github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
161 | github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
162 | github.com/jackc/pgproto3 v1.1.0 h1:FYYE4yRw+AgI8wXIinMlNjBbp/UitDJwfj5LqqewP1A=
163 | github.com/jackc/pgproto3 v1.1.0/go.mod h1:eR5FA3leWg7p9aeAqi37XOTgTIbkABlvcPB3E5rlc78=
164 | github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190420180111-c116219b62db/go.mod h1:bhq50y+xrl9n5mRYyCBFKkpRVTLYJVWeCc+mEAI3yXA=
165 | github.com/jackc/pgproto3/v2 v2.0.0-alpha1.0.20190609003834-432c2951c711/go.mod h1:uH0AWtUmuShn0bcesswc4aBTWGvw0cAxIJp+6OB//Wg=
166 | github.com/jackc/pgproto3/v2 v2.0.0-rc3/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
167 | github.com/jackc/pgproto3/v2 v2.0.0-rc3.0.20190831210041-4c03ce451f29/go.mod h1:ryONWYqW6dqSg1Lw6vXNMXoBJhpzvWKnT95C46ckYeM=
168 | github.com/jackc/pgproto3/v2 v2.0.1/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
169 | github.com/jackc/pgproto3/v2 v2.0.6 h1:b1105ZGEMFe7aCvrT1Cca3VoVb4ZFMaFJLJcg/3zD+8=
170 | github.com/jackc/pgproto3/v2 v2.0.6/go.mod h1:WfJCnwN3HIg9Ish/j3sgWXnAfK8A9Y0bwXYU5xKaEdA=
171 | github.com/jackc/pgservicefile v0.0.0-20200307190119-3430c5407db8/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
172 | github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b h1:C8S2+VttkHFdOOCXJe+YGfa4vHYwlt4Zx+IVXQ97jYg=
173 | github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b/go.mod h1:vsD4gTJCa9TptPL8sPkXrLZ+hDuNrZCnj29CQpr4X1E=
174 | github.com/jackc/pgtype v0.0.0-20190421001408-4ed0de4755e0/go.mod h1:hdSHsc1V01CGwFsrv11mJRHWJ6aifDLfdV3aVjFF0zg=
175 | github.com/jackc/pgtype v0.0.0-20190824184912-ab885b375b90/go.mod h1:KcahbBH1nCMSo2DXpzsoWOAfFkdEtEJpPbVLq8eE+mc=
176 | github.com/jackc/pgtype v0.0.0-20190828014616-a8802b16cc59/go.mod h1:MWlu30kVJrUS8lot6TQqcg7mtthZ9T0EoIBFiJcmcyw=
177 | github.com/jackc/pgtype v1.2.0/go.mod h1:5m2OfMh1wTK7x+Fk952IDmI4nw3nPrvtQdM0ZT4WpC0=
178 | github.com/jackc/pgtype v1.3.1-0.20200510190516-8cd94a14c75a/go.mod h1:vaogEUkALtxZMCH411K+tKzNpwzCKU+AnPzBKZ+I+Po=
179 | github.com/jackc/pgtype v1.3.1-0.20200606141011-f6355165a91c/go.mod h1:cvk9Bgu/VzJ9/lxTO5R5sf80p0DiucVtN7ZxvaC4GmQ=
180 | github.com/jackc/pgtype v1.7.0 h1:6f4kVsW01QftE38ufBYxKciO6gyioXSC0ABIRLcZrGs=
181 | github.com/jackc/pgtype v1.7.0/go.mod h1:ZnHF+rMePVqDKaOfJVI4Q8IVvAQMryDlDkZnKOI75BE=
182 | github.com/jackc/pgx/v4 v4.0.0-20190420224344-cc3461e65d96/go.mod h1:mdxmSJJuR08CZQyj1PVQBHy9XOp5p8/SHH6a0psbY9Y=
183 | github.com/jackc/pgx/v4 v4.0.0-20190421002000-1b8f0016e912/go.mod h1:no/Y67Jkk/9WuGR0JG/JseM9irFbnEPbuWV2EELPNuM=
184 | github.com/jackc/pgx/v4 v4.0.0-pre1.0.20190824185557-6972a5742186/go.mod h1:X+GQnOEnf1dqHGpw7JmHqHc1NxDoalibchSk9/RWuDc=
185 | github.com/jackc/pgx/v4 v4.5.0/go.mod h1:EpAKPLdnTorwmPUUsqrPxy5fphV18j9q3wrfRXgo+kA=
186 | github.com/jackc/pgx/v4 v4.6.1-0.20200510190926-94ba730bb1e9/go.mod h1:t3/cdRQl6fOLDxqtlyhe9UWgfIi9R8+8v8GKV5TRA/o=
187 | github.com/jackc/pgx/v4 v4.6.1-0.20200606145419-4e5062306904/go.mod h1:ZDaNWkt9sW1JMiNn0kdYBaLelIhw7Pg4qd+Vk6tw7Hg=
188 | github.com/jackc/pgx/v4 v4.11.0 h1:J86tSWd3Y7nKjwT/43xZBvpi04keQWx8gNC2YkdJhZI=
189 | github.com/jackc/pgx/v4 v4.11.0/go.mod h1:i62xJgdrtVDsnL3U8ekyrQXEwGNTRoG7/8r+CIdYfcc=
190 | github.com/jackc/puddle v0.0.0-20190413234325-e4ced69a3a2b/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
191 | github.com/jackc/puddle v0.0.0-20190608224051-11cab39313c9/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
192 | github.com/jackc/puddle v1.1.0/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
193 | github.com/jackc/puddle v1.1.1/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
194 | github.com/jackc/puddle v1.1.3/go.mod h1:m4B5Dj62Y0fbyuIc15OsIqK0+JU8nkqQjsgx7dvjSWk=
195 | github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
196 | github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
197 | github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
198 | github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
199 | github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
200 | github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
201 | github.com/json-iterator/go v1.1.11 h1:uVUAXhF2To8cbw/3xN3pxj6kk7TYKs98NIrTqPlMWAQ=
202 | github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
203 | github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
204 | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
205 | github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
206 | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
207 | github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
208 | github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
209 | github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
210 | github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
211 | github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
212 | github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
213 | github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
214 | github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
215 | github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
216 | github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
217 | github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w=
218 | github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
219 | github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
220 | github.com/lib/pq v1.1.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
221 | github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
222 | github.com/lib/pq v1.3.0 h1:/qkRGz8zljWiDcFvgpwUpwIAPu3r07TDvs3Rws+o/pU=
223 | github.com/lib/pq v1.3.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
224 | github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM=
225 | github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4=
226 | github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ=
227 | github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
228 | github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
229 | github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
230 | github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
231 | github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
232 | github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
233 | github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
234 | github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
235 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
236 | github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
237 | github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
238 | github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
239 | github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
240 | github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
241 | github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
242 | github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
243 | github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
244 | github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI=
245 | github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg=
246 | github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY=
247 | github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
248 | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
249 | github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
250 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
251 | github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
252 | github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
253 | github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI=
254 | github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
255 | github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
256 | github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg=
257 | github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU=
258 | github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k=
259 | github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w=
260 | github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
261 | github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w=
262 | github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c=
263 | github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs=
264 | github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
265 | github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo=
266 | github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
267 | github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
268 | github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
269 | github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk=
270 | github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis=
271 | github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74=
272 | github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
273 | github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
274 | github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA=
275 | github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw=
276 | github.com/openzipkin/zipkin-go v0.2.1/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
277 | github.com/openzipkin/zipkin-go v0.2.2/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnhQw8ySjnjRyN4=
278 | github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM=
279 | github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
280 | github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
281 | github.com/pelletier/go-toml v1.9.1 h1:a6qW1EVNZWH9WGI6CsYdD8WAylkoXBS5yv0XHlh17Tc=
282 | github.com/pelletier/go-toml v1.9.1/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
283 | github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac=
284 | github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc=
285 | github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY=
286 | github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
287 | github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
288 | github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
289 | github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA=
290 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
291 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
292 | github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
293 | github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
294 | github.com/prometheus/client_golang v0.9.3-0.20190127221311-3c4408c8b829/go.mod h1:p2iRAGwDERtqlqzRXnrOVns+ignqQo//hLXqYxZYVNs=
295 | github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
296 | github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og=
297 | github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
298 | github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
299 | github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
300 | github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
301 | github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
302 | github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
303 | github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
304 | github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA=
305 | github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
306 | github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
307 | github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
308 | github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
309 | github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
310 | github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
311 | github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
312 | github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
313 | github.com/rs/zerolog v1.13.0/go.mod h1:YbFCdg8HfsridGWAh22vktObvhZbQsZXe4/zB0OKkWU=
314 | github.com/rs/zerolog v1.15.0/go.mod h1:xYTKnLHcpfU2225ny5qZjxnj9NvkumZYjJHlAThCjNc=
315 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
316 | github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
317 | github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
318 | github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=
319 | github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
320 | github.com/shopspring/decimal v0.0.0-20180709203117-cd690d0c9e24/go.mod h1:M+9NzErvs504Cn4c5DxATwIqPbtswREoFCre64PpcG4=
321 | github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc h1:jUIKcSPO9MoMJBbEoyE/RJoE8vz7Mb8AjvifMMwSyvY=
322 | github.com/shopspring/decimal v0.0.0-20200227202807-02e2044944cc/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
323 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
324 | github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
325 | github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
326 | github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
327 | github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
328 | github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
329 | github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
330 | github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
331 | github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
332 | github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
333 | github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
334 | github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
335 | github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=
336 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
337 | github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
338 | github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
339 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
340 | github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
341 | github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
342 | github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
343 | github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
344 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
345 | github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE=
346 | github.com/tealeg/xlsx v1.0.5/go.mod h1:btRS8dz54TDnvKNosuAqxrM1QgN1udgk9O34bDCnORM=
347 | github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
348 | github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
349 | github.com/ugorji/go v1.2.6 h1:tGiWC9HENWE2tqYycIqFTNorMmFRVhNwCpDOpWqnk8E=
350 | github.com/ugorji/go v1.2.6/go.mod h1:anCg0y61KIhDlPZmnH+so+RQbysYVyDko0IMgJv0Nn0=
351 | github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
352 | github.com/ugorji/go/codec v1.2.6 h1:7kbGefxLoDBuYXOms4yD7223OpNMMPNPZxXk5TvFcyQ=
353 | github.com/ugorji/go/codec v1.2.6/go.mod h1:V6TCNZ4PHqoHGFZuSG1W8nrCzzdgA2DozYxWFFpvxTw=
354 | github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
355 | github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
356 | github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU=
357 | github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
358 | go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
359 | go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg=
360 | go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
361 | go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
362 | go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
363 | go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
364 | go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
365 | go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
366 | go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
367 | go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
368 | go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
369 | go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
370 | go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
371 | go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
372 | go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
373 | go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
374 | golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
375 | golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
376 | golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
377 | golang.org/x/crypto v0.0.0-20190411191339-88737f569e3a/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE=
378 | golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
379 | golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
380 | golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
381 | golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
382 | golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
383 | golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
384 | golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
385 | golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
386 | golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
387 | golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
388 | golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
389 | golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
390 | golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
391 | golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
392 | golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
393 | golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
394 | golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
395 | golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
396 | golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
397 | golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
398 | golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
399 | golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
400 | golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
401 | golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
402 | golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
403 | golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
404 | golang.org/x/net v0.0.0-20190125091013-d26f9f9a57f3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
405 | golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
406 | golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
407 | golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
408 | golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
409 | golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
410 | golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
411 | golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
412 | golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
413 | golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
414 | golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
415 | golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
416 | golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
417 | golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
418 | golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
419 | golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
420 | golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
421 | golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
422 | golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
423 | golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
424 | golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
425 | golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
426 | golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
427 | golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
428 | golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
429 | golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
430 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
431 | golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
432 | golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
433 | golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
434 | golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
435 | golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
436 | golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
437 | golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
438 | golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
439 | golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
440 | golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
441 | golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
442 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
443 | golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
444 | golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
445 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
446 | golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
447 | golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
448 | golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
449 | golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
450 | golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
451 | golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
452 | golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
453 | golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
454 | golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
455 | golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
456 | golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
457 | golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
458 | golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
459 | golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
460 | golang.org/x/tools v0.0.0-20190425163242-31fd60d6bfdc/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
461 | golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
462 | golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
463 | golang.org/x/tools v0.0.0-20190823170909-c4a336ef6a2f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
464 | golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
465 | golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
466 | golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
467 | golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
468 | golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
469 | golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
470 | golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
471 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
472 | golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
473 | google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
474 | google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
475 | google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
476 | google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
477 | google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
478 | google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
479 | google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
480 | google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s=
481 | google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
482 | google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
483 | google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
484 | google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM=
485 | google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
486 | google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
487 | google.golang.org/grpc v1.22.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
488 | google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
489 | google.golang.org/grpc v1.23.1/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
490 | google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
491 | google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
492 | google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
493 | google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
494 | gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
495 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
496 | gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
497 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
498 | gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
499 | gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
500 | gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
501 | gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
502 | gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
503 | gopkg.in/inconshreveable/log15.v2 v2.0.0-20180818164646-67afb5ed74ec/go.mod h1:aPpfJ7XW+gOuirDoZ8gHhLh3kZ1B08FtV2bbmy7Jv3s=
504 | gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
505 | gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
506 | gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
507 | gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74=
508 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
509 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
510 | gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
511 | gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
512 | gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
513 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
514 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
515 | honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
516 | honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
517 | honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
518 | honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
519 | sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o=
520 | sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q=
521 | sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc=
522 | sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU=
523 |
--------------------------------------------------------------------------------
/backend/main.go:
--------------------------------------------------------------------------------
1 | package main
2 |
3 | import (
4 | "fmt"
5 | "gistify/auth"
6 | "gistify/middleware"
7 | "gistify/models"
8 | "gistify/utils"
9 | "io/ioutil"
10 | "os"
11 | "path/filepath"
12 | "strings"
13 |
14 | "github.com/gin-gonic/gin"
15 | )
16 |
17 | // GetEnv return environmental variables
18 | func GetEnv() (string, string, []byte, string, string, string, string) {
19 | env := utils.GetEnv()
20 | githubClientID := os.Getenv(fmt.Sprintf("GISTIFY_%s_GITHUB_CLIENT_ID", env))
21 | githubClientSecret := os.Getenv(fmt.Sprintf("GISTIFY_%s_GITHUB_CLIENT_SECRET", env))
22 | jwtSecretKey := []byte(os.Getenv(fmt.Sprintf("GISTIFY_%s_JWT_SECRET_KEY", env)))
23 | gistApiToken := os.Getenv(fmt.Sprintf("GISTIFY_%s_GIST_API_TOKEN", env))
24 | gistifyAppURL := os.Getenv(fmt.Sprintf("GISTIFY_%s_APP_URL", env))
25 | databaseURL := "postgres://dinesh:simple@postgres:5432/dinesh-micro-apps"
26 | var cookieDomain string
27 | if env == "DEV" {
28 | cookieDomain = ".localhost"
29 | } else {
30 | cookieDomain = ".dineshsonachalam.com"
31 | }
32 | return githubClientID, githubClientSecret, jwtSecretKey, gistApiToken, gistifyAppURL, databaseURL, cookieDomain
33 | }
34 |
35 | // GithubOauthRedirect set JWT cookie & redirect to Github Oauth redirect URL
36 | func GithubOauthRedirect(c *gin.Context, githubClientID string, githubClientSecret string,
37 | jwtSecretKey []byte, databaseURL string, cookieDomain string, gistifyAppURL string) {
38 | requestToken := c.Request.FormValue("code")
39 | userDetails := auth.GithubUserDetails(githubClientID, githubClientSecret, requestToken)
40 | userInfo := make(map[string]string)
41 | userInfo["id"] = userDetails.Id
42 | userInfo["username"] = userDetails.Username
43 | jwtAccessToken := auth.CreateJwtAccessToken(userInfo, jwtSecretKey)
44 | models.CreateUserTable(databaseURL)
45 | models.CreateGistTable(databaseURL)
46 | isUserAlreadyPresent, _ := models.GetUser(databaseURL, userInfo["id"])
47 | if !isUserAlreadyPresent {
48 | models.CreateUser(databaseURL, userInfo["id"], userInfo["username"], userDetails.Email)
49 | }
50 | // Expiry time in minutes - Setting expiry time as 40 minute
51 | c.SetCookie("token", jwtAccessToken, (40 * 60), "/", cookieDomain, false, false)
52 | c.Redirect(301, gistifyAppURL+userInfo["username"])
53 | }
54 |
55 | // CreateNewGist return status of GIST creation
56 | func CreateNewGist(c *gin.Context, jwtSecretKey []byte, gistApiToken string,
57 | gistifyAppURL string, databaseURL string) {
58 | const BEARER_SCHEMA = "Bearer"
59 | authHeader := c.GetHeader("Authorization")
60 | tokenString := authHeader[len(BEARER_SCHEMA)+1:]
61 | isValidJwtToken := auth.ValidateJwtAccessToken(tokenString, jwtSecretKey)
62 | if isValidJwtToken {
63 | tokenExpiry, githubUserId, username := auth.IsJwtAccessTokenExpiryInFiveMin(tokenString)
64 | userInfo := make(map[string]string)
65 | userInfo["id"] = githubUserId
66 | userInfo["username"] = username
67 | if tokenExpiry {
68 | tokenString = auth.CreateJwtAccessToken(userInfo, jwtSecretKey)
69 | }
70 | formFile, err := c.FormFile("uploadfile")
71 | if err != nil {
72 | c.JSON(200, gin.H{
73 | "isFileUploaded": false,
74 | "gistURL": "",
75 | "gistID": "",
76 | "jwtAccessToken": "",
77 | "message": "Invalid file format",
78 | })
79 | } else {
80 | // Get raw file bytes - no reader method
81 | openedFile, _ := formFile.Open()
82 | file, _ := ioutil.ReadAll(openedFile)
83 | filename := filepath.Base(formFile.Filename)
84 | fileExtension := filepath.Ext(filename)
85 |
86 | newFilename := (strings.Split(filename, "."))[0] + ".json"
87 | ParserResponse := utils.ParserResponse{}
88 |
89 | if fileExtension == ".yaml" || fileExtension == ".yml" {
90 | ParserResponse = utils.YAMLToJSON(file)
91 | } else if fileExtension == ".toml" {
92 | ParserResponse = utils.TOMLToJSON(file)
93 | } else if fileExtension == ".csv" {
94 | ParserResponse = utils.CSVToJSON(file)
95 | } else if fileExtension == ".xlsx" {
96 | ParserResponse = utils.ExcelToJSON(file)
97 | }
98 |
99 | fileExtension = strings.Replace(fileExtension, ".", "", -1)
100 | FileParsed := ParserResponse.FileParsed
101 | JsonString := ParserResponse.JsonString
102 | if FileParsed {
103 | UploadResponse := utils.UploadJsonToGist(gistApiToken, filename, newFilename, JsonString, userInfo["username"], gistifyAppURL)
104 | models.CreateGist(databaseURL, UploadResponse.GistId, newFilename, fileExtension, UploadResponse.GistURL, githubUserId)
105 | c.JSON(200, gin.H{
106 | "isFileUploaded": UploadResponse.FileUpload,
107 | "gistURL": UploadResponse.GistURL,
108 | "gistID": UploadResponse.GistId,
109 | "jwtAccessToken": tokenString,
110 | "message": "Conversion and upload was successful",
111 | })
112 | } else {
113 | c.JSON(200, gin.H{
114 | "isFileUploaded": false,
115 | "gistURL": "",
116 | "gistID": "",
117 | "jwtAccessToken": tokenString,
118 | "message": "Conversion to JSON failed",
119 | })
120 | }
121 | }
122 | } else {
123 | c.JSON(200, gin.H{
124 | "isFileUploaded": false,
125 | "gistURL": "",
126 | "gistID": "",
127 | "jwtAccessToken": "",
128 | "message": "Invalid JWT access token",
129 | })
130 | }
131 | }
132 |
133 | // DeleteGist return status of GIST deletion
134 | func DeleteGist(c *gin.Context, jwtSecretKey []byte, gistApiToken string, databaseURL string) {
135 | const BEARER_SCHEMA = "Bearer"
136 | authHeader := c.GetHeader("Authorization")
137 | tokenString := authHeader[len(BEARER_SCHEMA)+1:]
138 | isValidJwtToken := auth.ValidateJwtAccessToken(tokenString, jwtSecretKey)
139 | if isValidJwtToken {
140 | tokenExpiry, githubUserId, username := auth.IsJwtAccessTokenExpiryInFiveMin(tokenString)
141 | userInfo := make(map[string]string)
142 | userInfo["id"] = githubUserId
143 | userInfo["username"] = username
144 | if tokenExpiry {
145 | tokenString = auth.CreateJwtAccessToken(userInfo, jwtSecretKey)
146 | }
147 | gistID := c.Param("gistID")
148 | gistURL := fmt.Sprintf("https://api.github.com/gists/%v", gistID)
149 | payload := strings.NewReader(`{}`)
150 | headers := map[string]string{
151 | "Authorization": fmt.Sprintf("Bearer %s", gistApiToken),
152 | "Content-Type": "application/json",
153 | }
154 | GistDeleteResponse := utils.Request("DELETE", gistURL, payload, headers)
155 | models.DeleteGist(databaseURL, gistID, githubUserId)
156 | if GistDeleteResponse.Status {
157 | c.JSON(200, gin.H{
158 | "isDeleted": true,
159 | "jwtAccessToken": tokenString,
160 | })
161 | } else {
162 | c.JSON(200, gin.H{
163 | "isDeleted": false,
164 | "jwtAccessToken": "",
165 | })
166 | }
167 | } else {
168 | c.JSON(200, gin.H{
169 | "isDeleted": false,
170 | "jwtAccessToken": "",
171 | })
172 | }
173 | }
174 |
175 | // GetAllGists return all GIST created by an user
176 | func GetAllGists(c *gin.Context, jwtSecretKey []byte, databaseURL string) {
177 | const BEARER_SCHEMA = "Bearer"
178 | authHeader := c.GetHeader("Authorization")
179 | tokenString := authHeader[len(BEARER_SCHEMA)+1:]
180 | isValidJwtToken := auth.ValidateJwtAccessToken(tokenString, jwtSecretKey)
181 | if isValidJwtToken {
182 | tokenExpiry, id, username := auth.IsJwtAccessTokenExpiryInFiveMin(tokenString)
183 | userInfo := make(map[string]string)
184 | userInfo["id"] = id
185 | userInfo["username"] = username
186 | if tokenExpiry {
187 | tokenString = auth.CreateJwtAccessToken(userInfo, jwtSecretKey)
188 | }
189 | gistData := models.GetAllGist(databaseURL, id)
190 | c.JSON(200, gin.H{
191 | "isDeleted": true,
192 | "gistData": gistData,
193 | "jwtAccessToken": tokenString,
194 | })
195 | } else {
196 | c.JSON(200, gin.H{
197 | "isDeleted": false,
198 | "jwtAccessToken": "",
199 | })
200 | }
201 | }
202 |
203 | // GetGist return a gist created by an user by gist ID
204 | func GetGist(c *gin.Context, jwtSecretKey []byte, databaseURL string) {
205 | gistID := c.Param("gistID")
206 | const BEARER_SCHEMA = "Bearer"
207 | authHeader := c.GetHeader("Authorization")
208 | tokenString := authHeader[len(BEARER_SCHEMA)+1:]
209 | isValidJwtToken := auth.ValidateJwtAccessToken(tokenString, jwtSecretKey)
210 | if isValidJwtToken {
211 | tokenExpiry, id, username := auth.IsJwtAccessTokenExpiryInFiveMin(tokenString)
212 | userInfo := make(map[string]string)
213 | userInfo["id"] = id
214 | userInfo["username"] = username
215 | if tokenExpiry {
216 | tokenString = auth.CreateJwtAccessToken(userInfo, jwtSecretKey)
217 | }
218 | gistData := models.GetGist(databaseURL, gistID)
219 | c.JSON(200, gin.H{
220 | "isDeleted": true,
221 | "gistData": gistData,
222 | "jwtAccessToken": tokenString,
223 | })
224 | } else {
225 | c.JSON(200, gin.H{
226 | "isDeleted": false,
227 | "jwtAccessToken": "",
228 | })
229 | }
230 | }
231 |
232 | func main() {
233 | githubClientID, githubClientSecret, jwtSecretKey, gistApiToken, gistifyAppURL, databaseURL, cookieDomain := GetEnv()
234 | r := gin.Default()
235 | r.Use(middleware.CORSMiddleware())
236 | if (len(githubClientID) > 0) && (len(githubClientSecret) > 0) {
237 | // Github Oauth redirect
238 | r.GET("/oauth/redirect", func(c *gin.Context) {
239 | GithubOauthRedirect(c, githubClientID, githubClientSecret,
240 | jwtSecretKey, databaseURL, cookieDomain,
241 | gistifyAppURL)
242 | })
243 |
244 | // Create a new gist
245 | r.POST("/gists", func(c *gin.Context) {
246 | CreateNewGist(c, jwtSecretKey, gistApiToken, gistifyAppURL, databaseURL)
247 | })
248 |
249 | // Delete a gist
250 | r.DELETE("/gists/:gistID", func(c *gin.Context) {
251 | DeleteGist(c, jwtSecretKey, gistApiToken, databaseURL)
252 | })
253 |
254 | // Get all gists created by user
255 | r.GET("/gists", func(c *gin.Context) {
256 | GetAllGists(c, jwtSecretKey, databaseURL)
257 | })
258 |
259 | // Get a gist by GIST id
260 | r.GET("/gists/:gistID", func(c *gin.Context) {
261 | GetGist(c, jwtSecretKey, databaseURL)
262 | })
263 | r.Run(":8003")
264 | } else {
265 | fmt.Println("Please set the env variables in ~/.zshrc (OSX - Mac)")
266 | }
267 | }
268 |
--------------------------------------------------------------------------------
/backend/middleware/handlers.go:
--------------------------------------------------------------------------------
1 | package middleware
2 |
3 | import (
4 | "github.com/gin-gonic/gin"
5 | )
6 |
7 | // CORSMiddleware return CORS Headers
8 | func CORSMiddleware() gin.HandlerFunc {
9 | return func(c *gin.Context) {
10 | c.Header("Access-Control-Allow-Origin", "*")
11 | c.Header("Access-Control-Allow-Credentials", "true")
12 | c.Header("Access-Control-Allow-Headers", "Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, accept, origin, Cache-Control, X-Requested-With")
13 | c.Header("Access-Control-Allow-Methods", "POST,HEAD,PATCH, OPTIONS, GET, PUT, DELETE")
14 |
15 | if c.Request.Method == "OPTIONS" {
16 | c.AbortWithStatus(204)
17 | return
18 | }
19 | c.Next()
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/backend/models/models.go:
--------------------------------------------------------------------------------
1 | package models
2 |
3 | import (
4 | "context"
5 | "time"
6 |
7 | "github.com/jackc/pgx/v4"
8 | )
9 |
10 | // CreateUserTable return status of user table creation
11 | func CreateUserTable(databaseURL string) bool {
12 | conn, err := pgx.Connect(context.Background(), databaseURL)
13 | if err != nil {
14 | return false
15 | }
16 | defer conn.Close(context.Background())
17 | _, err = conn.Exec(context.Background(), "CREATE TABLE IF NOT EXISTS app_user(id VARCHAR(255) PRIMARY KEY NOT NULL, username VARCHAR(255) NOT NULL, emailID VARCHAR(255) NOT NULL, createdAt TIMESTAMPTZ DEFAULT Now())")
18 | return err == nil
19 | }
20 |
21 | // CreateGistTable return status of gist table creation
22 | func CreateGistTable(databaseURL string) bool {
23 | conn, err := pgx.Connect(context.Background(), databaseURL)
24 | if err != nil {
25 | return false
26 | }
27 | defer conn.Close(context.Background())
28 | _, err = conn.Exec(context.Background(), "CREATE TABLE IF NOT EXISTS gist(id VARCHAR(255) PRIMARY KEY NOT NULL, filename VARCHAR(255) NOT NULL, generatedFrom VARCHAR(255) NOT NULL, url VARCHAR(255) NOT NULL, githubUserID VARCHAR(255) NOT NULL references app_user(id), createdAt TIMESTAMPTZ DEFAULT Now())")
29 | return err == nil
30 | }
31 |
32 | // CreateUser return status of user creation
33 | func CreateUser(databaseURL string, id string, username string, emailID string) bool {
34 | conn, err := pgx.Connect(context.Background(), databaseURL)
35 | if err != nil {
36 | return false
37 | }
38 | defer conn.Close(context.Background())
39 | _, err = conn.Exec(context.Background(), "INSERT INTO app_user(id, username, emailID) VALUES($1, $2, $3)", id, username, emailID)
40 | return err == nil
41 | }
42 |
43 | // GetUser return status of user id availability in the database and the username
44 | func GetUser(databaseURL string, id string) (bool, string) {
45 | conn, err := pgx.Connect(context.Background(), databaseURL)
46 | var githubUserID string
47 | var username string
48 | if err != nil {
49 | return false, username
50 | }
51 | defer conn.Close(context.Background())
52 | err = conn.QueryRow(context.Background(), "select id, username from app_user where id=$1", id).Scan(&githubUserID, &username)
53 | if err != nil || githubUserID != id {
54 | return false, username
55 | }
56 | return true, username
57 | }
58 |
59 | // CreateGist return status of gist creation
60 | func CreateGist(databaseURL string, id string, filename string, generatedFrom string, url string, githubUserID string) bool {
61 | conn, err := pgx.Connect(context.Background(), databaseURL)
62 | if err != nil {
63 | return false
64 | }
65 | defer conn.Close(context.Background())
66 | _, err = conn.Exec(context.Background(), "INSERT INTO gist(id, filename, generatedFrom, url, githubUserID) VALUES($1, $2, $3, $4, $5)", id, filename, generatedFrom, url, githubUserID)
67 | return err == nil
68 | }
69 |
70 | // DeleteGist return status of gist deletion
71 | func DeleteGist(databaseURL string, gistID string, githubUserID string) bool {
72 | conn, err := pgx.Connect(context.Background(), databaseURL)
73 | if err != nil {
74 | return false
75 | }
76 | defer conn.Close(context.Background())
77 | _, err = conn.Exec(context.Background(), "DELETE FROM gist WHERE id=$1 AND githubUserID=$2", gistID, githubUserID)
78 | return err == nil
79 | }
80 |
81 | // GetAllGist return all gist created by a user
82 | func GetAllGist(databaseURL string, githubUserID string) []map[string]interface{} {
83 | conn, err := pgx.Connect(context.Background(), databaseURL)
84 | gistData := make([]map[string]interface{}, 0)
85 | if err != nil {
86 | return gistData
87 | }
88 | defer conn.Close(context.Background())
89 | rows, err := conn.Query(context.Background(), "SELECT id, filename, generatedFrom, url, date_trunc('second', createdAt) as createdAt FROM gist WHERE githubUserID=$1 ORDER BY createdAt DESC NULLS LAST", githubUserID)
90 | if err != nil {
91 | return gistData
92 | }
93 | defer rows.Close()
94 | for rows.Next() {
95 | var id string
96 | var filename string
97 | var generatedFrom string
98 | var url string
99 | var createdAt time.Time
100 | err = rows.Scan(&id, &filename, &generatedFrom, &url, &createdAt)
101 | if err != nil {
102 | return gistData
103 | }
104 | var gist = make(map[string]interface{})
105 | gist["key"] = id
106 | gist["filename"] = filename
107 | gist["generatedFrom"] = generatedFrom
108 | gist["url"] = url
109 | gist["createdAt"] = createdAt
110 | gistData = append(gistData, gist)
111 | }
112 | return gistData
113 | }
114 |
115 | // GetGist return a gist created by a user
116 | func GetGist(databaseURL string, gistID string) map[string]interface{} {
117 | conn, err := pgx.Connect(context.Background(), databaseURL)
118 | gistData := make(map[string]interface{})
119 | if err != nil {
120 | return gistData
121 | }
122 | defer conn.Close(context.Background())
123 | rows, err := conn.Query(context.Background(), "SELECT id, filename, generatedFrom, url, date_trunc('second', createdAt) as createdAt FROM gist WHERE id=$1", gistID)
124 | if err != nil {
125 | return gistData
126 | }
127 | defer rows.Close()
128 | for rows.Next() {
129 | var id string
130 | var filename string
131 | var generatedFrom string
132 | var url string
133 | var createdAt time.Time
134 | err = rows.Scan(&id, &filename, &generatedFrom, &url, &createdAt)
135 | if err != nil {
136 | return gistData
137 | }
138 | gistData["key"] = id
139 | gistData["filename"] = filename
140 | gistData["generatedFrom"] = generatedFrom
141 | gistData["url"] = url
142 | gistData["createdAt"] = createdAt
143 | }
144 | return gistData
145 | }
146 |
--------------------------------------------------------------------------------
/backend/utils/crud.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "encoding/json"
5 | "io/ioutil"
6 | "net/http"
7 | "strings"
8 | )
9 |
10 | // HttpRequest represents the response of HTTP request
11 | type HttpRequest struct {
12 | Status bool
13 | ResponseBody map[string]interface{}
14 | }
15 |
16 | // Request return HTTP GET/POST/DELETE JSON response
17 | func Request(requestType string, url string, payload *strings.Reader, headers map[string]string) HttpRequest {
18 | client := &http.Client{}
19 | req, err := http.NewRequest(requestType, url, payload)
20 | if err != nil {
21 | return HttpRequest{}
22 | }
23 | for headerKey, headerValue := range headers {
24 | req.Header.Add(headerKey, headerValue)
25 | }
26 | response, err := client.Do(req)
27 | if err != nil {
28 | return HttpRequest{}
29 | }
30 | defer response.Body.Close()
31 | if response.StatusCode >= 200 && response.StatusCode <= 299 {
32 | responseBody, err := ioutil.ReadAll(response.Body)
33 | if err != nil {
34 | return HttpRequest{}
35 | }
36 | jsonResponse := make(map[string]interface{})
37 | json.Unmarshal(responseBody, &jsonResponse)
38 | return HttpRequest{true, jsonResponse}
39 | }
40 | return HttpRequest{}
41 | }
42 |
--------------------------------------------------------------------------------
/backend/utils/getEnv.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "os"
5 | )
6 |
7 | // GetEnv return APP env (dev or prod)
8 | func GetEnv() string {
9 | return os.Getenv("GISTIFY_APP_ENV")
10 | }
11 |
--------------------------------------------------------------------------------
/backend/utils/gist.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "encoding/json"
5 | "fmt"
6 | "strings"
7 | )
8 |
9 | // UploadResponse represents the response of the Github Gist upload
10 | type UploadResponse struct {
11 | FileUpload bool
12 | GistId string
13 | GistURL string
14 | }
15 |
16 | // UploadJsonToGist return status of uploading JSON to gist
17 | func UploadJsonToGist(GIST_API_TOKEN string, fileName string, newFilename string, jsonString string, author string, appUrl string) UploadResponse {
18 | gistUrl := "https://api.github.com/gists"
19 | headers := map[string]string{
20 | "Authorization": fmt.Sprintf("Bearer %s", GIST_API_TOKEN),
21 | "Content-Type": "application/json",
22 | }
23 | jsonData := fmt.Sprintf(`%s`, jsonString)
24 | jsonBytes, _ := json.Marshal(jsonData)
25 | responseBody := fmt.Sprintf(`{
26 | "public": true,
27 | "files": {
28 | "%s": {
29 | "content": %s
30 | }
31 | },
32 | "description": "Generated from %s by %s. Gist created by user: %s."
33 | }`, newFilename, string(jsonBytes), fileName, appUrl, author)
34 | jsonPayload := string(responseBody)
35 | payload := strings.NewReader(jsonPayload)
36 | uploadResponse := Request("POST", gistUrl, payload, headers)
37 | if uploadResponse.Status {
38 | isFileUploaded := true
39 | gistID := fmt.Sprintf("%v", uploadResponse.ResponseBody["id"])
40 | gistURL := fmt.Sprintf("%v", uploadResponse.ResponseBody["html_url"])
41 | return UploadResponse{isFileUploaded, gistID, gistURL}
42 | }
43 | return UploadResponse{}
44 | }
45 |
--------------------------------------------------------------------------------
/backend/utils/parser.go:
--------------------------------------------------------------------------------
1 | package utils
2 |
3 | import (
4 | "bytes"
5 | "container/list"
6 | "encoding/csv"
7 | "encoding/json"
8 | "strings"
9 |
10 | "github.com/pelletier/go-toml"
11 | "github.com/tealeg/xlsx"
12 | "sigs.k8s.io/yaml"
13 | )
14 |
15 | // ParserResponse represents the Parser JSON response
16 | type ParserResponse struct {
17 | FileParsed bool
18 | JsonString string
19 | }
20 |
21 | // GetParserResponse return Parsed JSON response
22 | func GetParserResponse(parsedData []map[string]interface{}) ParserResponse {
23 | parsedJson, err := json.MarshalIndent(parsedData, "", " ")
24 | if err != nil {
25 | return ParserResponse{}
26 | }
27 | jsonString := string(parsedJson)
28 | return ParserResponse{true, jsonString}
29 | }
30 |
31 | // YAMLToJSON convert YAML to JSON return map
32 | func YAMLToJSON(data []byte) ParserResponse {
33 | parsedData, _ := yaml.YAMLToJSON(data)
34 | jsonMap := make(map[string]interface{})
35 | if err := json.Unmarshal(parsedData, &jsonMap); err != nil {
36 | return ParserResponse{}
37 | }
38 | parsedJson, err := json.MarshalIndent(jsonMap, "", " ")
39 | jsonString := string(parsedJson)
40 | if err != nil {
41 | return ParserResponse{}
42 | }
43 | return ParserResponse{true, jsonString}
44 | }
45 |
46 | // TOMLToJSON convert TOML to JSON return map
47 | func TOMLToJSON(data []byte) ParserResponse {
48 | readerData := strings.NewReader(string(data))
49 | tree, err := toml.LoadReader(readerData)
50 | if err != nil {
51 | return ParserResponse{}
52 | }
53 | treeMap := tree.ToMap()
54 | bytes, err := json.MarshalIndent(treeMap, "", " ")
55 | if err != nil {
56 | return ParserResponse{}
57 | }
58 | jsonString := string(bytes[:])
59 | return ParserResponse{true, jsonString}
60 | }
61 |
62 | // CSVToJSON convert CSV to JSON return map
63 | func CSVToJSON(data []byte) ParserResponse {
64 | bytesData := bytes.NewReader(data)
65 | // create a new reader
66 | r := csv.NewReader(bytesData)
67 | records, err := r.ReadAll()
68 | if err != nil {
69 | return ParserResponse{}
70 | }
71 | parsedData := make([]map[string]interface{}, 0)
72 | headerName := records[0]
73 | for rowCounter, row := range records {
74 | if rowCounter != 0 {
75 | var singleMap = make(map[string]interface{})
76 | for colCounter, col := range row {
77 | singleMap[headerName[colCounter]] = col
78 | }
79 | if len(singleMap) > 0 {
80 |
81 | parsedData = append(parsedData, singleMap)
82 | }
83 | }
84 | }
85 | if len(parsedData) > 0 {
86 | return GetParserResponse(parsedData)
87 | }
88 | return ParserResponse{}
89 | }
90 |
91 | // ExcelToJSON convert Excel to JSON return map
92 | func ExcelToJSON(data []byte) ParserResponse {
93 | xlFile, err := xlsx.OpenBinary(data)
94 | if err != nil {
95 | return ParserResponse{}
96 | }
97 | parsedData := make([]map[string]interface{}, 0)
98 | headerName := list.New()
99 | // sheet
100 | for _, sheet := range xlFile.Sheets {
101 | // rows
102 | for rowCounter, row := range sheet.Rows {
103 | // column
104 | headerIterator := headerName.Front()
105 | var singleMap = make(map[string]interface{})
106 |
107 | for _, cell := range row.Cells {
108 | if rowCounter == 0 {
109 | text := cell.String()
110 | headerName.PushBack(text)
111 | } else {
112 | text := cell.String()
113 | singleMap[headerIterator.Value.(string)] = text
114 | headerIterator = headerIterator.Next()
115 | }
116 | }
117 | if rowCounter != 0 && len(singleMap) > 0 {
118 |
119 | parsedData = append(parsedData, singleMap)
120 | }
121 |
122 | }
123 | }
124 | if len(parsedData) > 0 {
125 | return GetParserResponse(parsedData)
126 | }
127 | return ParserResponse{}
128 | }
129 |
--------------------------------------------------------------------------------
/dev-startup.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | echo "127.0.0.1 postgres" | sudo tee -a /etc/hosts
3 | echo "💾 Installing frontend dependencies"
4 | npm i --prefix frontend
5 | echo "🚀 Starting frontend and backend app"
6 | npm run start --prefix frontend &
7 | cd backend && go run main.go &
8 | echo "📦📦📦 Running docker-compose"
9 | docker-compose down
10 | docker-compose up
11 |
--------------------------------------------------------------------------------
/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | postgres:
4 | image: "postgres:9.6.21"
5 | networks:
6 | - frontend
7 | ports:
8 | - "5432:5432"
9 | restart: always
10 | user: 1000:1000
11 | environment:
12 | - POSTGRES_USER=dinesh
13 | - POSTGRES_PASSWORD=simple
14 | - POSTGRES_DB=dinesh-micro-apps
15 | volumes:
16 | - ./data:/var/lib/postgresql/data:z # persist data even if container shuts down
17 |
18 | networks:
19 | frontend:
20 |
--------------------------------------------------------------------------------
/frontend.Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:16.6.0-slim
2 |
3 | # Create app directory
4 | WORKDIR /usr/src/app
5 |
6 | # Install app dependencies
7 | RUN npm init -y
8 | RUN npm i -s express
9 |
10 | COPY frontend .
11 |
12 | EXPOSE 3000
13 | CMD [ "node", "server.js" ]
--------------------------------------------------------------------------------
/frontend/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dineshsonachalam/gistify/511f241251c1395899c80baf8d30eeaa777894bc/frontend/.DS_Store
--------------------------------------------------------------------------------
/frontend/.env.dev:
--------------------------------------------------------------------------------
1 | REACT_APP_API_ENDPOINT = "http://localhost:8003"
2 | REACT_APP_GITHUB_CLIENT_ID = "21c29d28ab59b778a8bd"
3 | REACT_APP_COOKIE_DOMAIN = "localhost"
4 |
5 |
--------------------------------------------------------------------------------
/frontend/.env.prod:
--------------------------------------------------------------------------------
1 | REACT_APP_API_ENDPOINT = "https://api--gistify.dineshsonachalam.com"
2 | REACT_APP_GITHUB_CLIENT_ID = "fb83e5744c3ae9560260"
3 | REACT_APP_COOKIE_DOMAIN = "dineshsonachalam.com"
4 |
--------------------------------------------------------------------------------
/frontend/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | lerna-debug.log*
8 |
9 | # Diagnostic reports (https://nodejs.org/api/report.html)
10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11 |
12 | # Runtime data
13 | pids
14 | *.pid
15 | *.seed
16 | *.pid.lock
17 |
18 | # Directory for instrumented libs generated by jscoverage/JSCover
19 | lib-cov
20 |
21 | # Coverage directory used by tools like istanbul
22 | coverage
23 | *.lcov
24 |
25 | # nyc test coverage
26 | .nyc_output
27 |
28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29 | .grunt
30 |
31 | # Bower dependency directory (https://bower.io/)
32 | bower_components
33 |
34 | # node-waf configuration
35 | .lock-wscript
36 |
37 | # Compiled binary addons (https://nodejs.org/api/addons.html)
38 | build/Release
39 |
40 | # Dependency directories
41 | node_modules/
42 | jspm_packages/
43 |
44 | # Snowpack dependency directory (https://snowpack.dev/)
45 | web_modules/
46 |
47 | # TypeScript cache
48 | *.tsbuildinfo
49 |
50 | # Optional npm cache directory
51 | .npm
52 |
53 | # Optional eslint cache
54 | .eslintcache
55 |
56 | # Microbundle cache
57 | .rpt2_cache/
58 | .rts2_cache_cjs/
59 | .rts2_cache_es/
60 | .rts2_cache_umd/
61 |
62 | # Optional REPL history
63 | .node_repl_history
64 |
65 | # Output of 'npm pack'
66 | *.tgz
67 |
68 | # Yarn Integrity file
69 | .yarn-integrity
70 |
71 | # dotenv environment variables file
72 | .env
73 | .env.test
74 |
75 | # parcel-bundler cache (https://parceljs.org/)
76 | .cache
77 | .parcel-cache
78 |
79 | # Next.js build output
80 | .next
81 | out
82 |
83 | # Nuxt.js build / generate output
84 | .nuxt
85 | dist
86 |
87 | # Gatsby files
88 | .cache/
89 | # Comment in the public line in if your project uses Gatsby and not Next.js
90 | # https://nextjs.org/blog/next-9-1#public-directory-support
91 | # public
92 |
93 | # vuepress build output
94 | .vuepress/dist
95 |
96 | # Serverless directories
97 | .serverless/
98 |
99 | # FuseBox cache
100 | .fusebox/
101 |
102 | # DynamoDB Local files
103 | .dynamodb/
104 |
105 | # TernJS port file
106 | .tern-port
107 |
108 | # Stores VSCode versions used for testing VSCode extensions
109 | .vscode-test
110 |
111 | # yarn v2
112 | .yarn/cache
113 | .yarn/unplugged
114 | .yarn/build-state.yml
115 | .yarn/install-state.gz
116 | .pnp.*
--------------------------------------------------------------------------------
/frontend/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "frontend",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@ant-design/icons": "^4.6.2",
7 | "@microlink/react": "^5.5.5",
8 | "@testing-library/jest-dom": "^5.11.4",
9 | "@testing-library/react": "^11.1.0",
10 | "@testing-library/user-event": "^12.1.10",
11 | "antd": "^4.15.2",
12 | "antd-mobile": "^2.3.4",
13 | "cypress": "^7.3.0",
14 | "env-cmd": "^10.1.0",
15 | "jwt-decode": "^3.1.2",
16 | "lodash.throttle": "^4.1.1",
17 | "react": "^17.0.2",
18 | "react-cookies": "^0.1.1",
19 | "react-dom": "^17.0.2",
20 | "react-iframe": "^1.8.0",
21 | "react-redux": "^7.2.3",
22 | "react-router-dom": "^5.2.0",
23 | "react-scripts": "4.0.3",
24 | "react-tiny-link": "^3.6.1",
25 | "redux": "^4.0.5",
26 | "reqwest": "^2.0.5",
27 | "styled-components": "^5.2.3",
28 | "universal-cookie": "^4.0.4",
29 | "web-vitals": "^1.0.1"
30 | },
31 | "scripts": {
32 | "start": "env-cmd -f .env.dev react-scripts start",
33 | "build": "env-cmd -f .env.prod react-scripts build",
34 | "test": "react-scripts test",
35 | "eject": "react-scripts eject",
36 | "cypress": "cypress open"
37 | },
38 | "eslintConfig": {
39 | "extends": [
40 | "react-app",
41 | "react-app/jest"
42 | ]
43 | },
44 | "browserslist": {
45 | "production": [
46 | ">0.2%",
47 | "not dead",
48 | "not op_mini all"
49 | ],
50 | "development": [
51 | "last 1 chrome version",
52 | "last 1 firefox version",
53 | "last 1 safari version"
54 | ]
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/frontend/public/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dineshsonachalam/gistify/511f241251c1395899c80baf8d30eeaa777894bc/frontend/public/.DS_Store
--------------------------------------------------------------------------------
/frontend/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
11 |
12 |
13 |
22 | Gistify
23 |
24 |
25 |
28 |
29 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/frontend/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | }
10 | ],
11 | "start_url": "./index.html",
12 | "display": "standalone",
13 | "theme_color": "#000000",
14 | "background_color": "#ffffff"
15 | }
16 |
--------------------------------------------------------------------------------
/frontend/public/sf.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dineshsonachalam/gistify/511f241251c1395899c80baf8d30eeaa777894bc/frontend/public/sf.png
--------------------------------------------------------------------------------
/frontend/server.js:
--------------------------------------------------------------------------------
1 | const express = require("express");
2 | const path = require("path");
3 | const app = express();
4 |
5 | app.use(express.static(path.join(__dirname, "build")));
6 |
7 | app.get("/", function (req, res) {
8 | res.sendFile(path.join(__dirname, "build", "index.html"));
9 | });
10 |
11 | app.get("/*", function(req, res) {
12 | res.sendFile(path.join(__dirname, "build", "index.html"), function(err) {
13 | if (err) {
14 | res.status(500).send(err);
15 | }
16 | });
17 | });
18 |
19 | app.listen(3000);
20 |
--------------------------------------------------------------------------------
/frontend/src/App.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import Login from "./pages/Login";
3 | import Dashboard from "./pages/Dashboard";
4 | import {
5 | BrowserRouter as Router,
6 | Switch,
7 | Route
8 | } from "react-router-dom";
9 |
10 | function App() {
11 | return (
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | );
21 | }
22 |
23 | export default App;
--------------------------------------------------------------------------------
/frontend/src/components/Footer/index.js:
--------------------------------------------------------------------------------
1 | import { connect } from "react-redux";
2 | import React from "react";
3 | import { Layout } from "antd";
4 | const { Footer } = Layout;
5 |
6 |
7 | class PageFooter extends React.Component {
8 | render(){
9 | return (
10 |
13 | );
14 | }
15 | }
16 | // https://stackoverflow.com/a/50225424
17 | const mapStateToProps = (state) => {
18 | return state.gistifyReducer;
19 | };
20 |
21 | const mapDispatchToProps = (dispatch) => {
22 | return {};
23 | };
24 |
25 | export default connect(mapStateToProps, mapDispatchToProps)(PageFooter);
26 |
27 |
--------------------------------------------------------------------------------
/frontend/src/components/GistTable/index.js:
--------------------------------------------------------------------------------
1 | import Cookies from "universal-cookie";
2 | import React from "react";
3 | import "antd/dist/antd.css";
4 | import { Table, Popconfirm} from "antd";
5 | import { updateGists } from "./../../redux/actions";
6 | import { connect } from "react-redux";
7 | const cookies = new Cookies();
8 |
9 | class GistTable extends React.Component {
10 | async getData(url, requestOptions) {
11 | const response = await fetch(url,requestOptions);
12 | return response.json();
13 | }
14 |
15 | async componentDidMount(){
16 | let url = `${process.env.REACT_APP_API_ENDPOINT}/gists`
17 | let jwtToken = cookies.get("token", {path: "/", domain: `${process.env.REACT_APP_COOKIE_DOMAIN}`});
18 | let headers = new Headers();
19 | headers.append("Authorization", `Bearer ${jwtToken}`)
20 | let requestOptions = {
21 | method: "GET",
22 | headers,
23 | redirect: "follow"
24 | };
25 | let gistData = await this.getData(url, requestOptions)
26 | this.props.updateGists(gistData["gistData"])
27 | }
28 |
29 | handleDelete = (key) => {
30 | const dataSource = this.props.gists;
31 | let url = `${process.env.REACT_APP_API_ENDPOINT}/gists/${key}`
32 | let jwtToken = cookies.get("token", {path: "/", domain: `${process.env.REACT_APP_COOKIE_DOMAIN}`});
33 | let headers = new Headers();
34 | headers.append("Authorization", `Bearer ${jwtToken}`)
35 | let requestOptions = {
36 | method: "DELETE",
37 | headers,
38 | redirect: "follow"
39 | };
40 | fetch(url, requestOptions)
41 | .then(response => response.json())
42 | .then(result => console.log("Key: ,Result: ",key, result))
43 | .catch(error => console.log("error", error));
44 | this.props.updateGists(dataSource.filter((item) => item.key !== key));
45 | };
46 |
47 | render(){
48 | const dataSource = this.props.gists;
49 | let columns = [
50 | {
51 | title: "Filename",
52 | dataIndex: "filename",
53 | },
54 | {
55 | title: "Generated from",
56 | dataIndex: "generatedFrom",
57 | },
58 | {
59 | title: "URL",
60 | dataIndex: "url",
61 | render: (text, row, index) => {
62 | return {text};
63 | },
64 | },
65 | {
66 | title: "Created at",
67 | dataIndex: "createdAt",
68 | },
69 | {
70 | title: "Operation",
71 | dataIndex: "operation",
72 | render: (_, record) =>
73 | this.props.gists.length >= 1 ? (
74 | this.handleDelete(record.key)}>
75 | {// eslint-disable-next-line
76 | }Delete
77 |
78 | ) : null,
79 | },
80 | ];
81 | return (
82 |
90 | );
91 | }
92 | }
93 | // https://stackoverflow.com/a/50225424
94 | const mapStateToProps = (state) => {
95 | return state.gistifyReducer;
96 | };
97 |
98 | const mapDispatchToProps = (dispatch) => {
99 | return {
100 | updateGists: (gists) => dispatch(updateGists(gists)),
101 | };
102 | };
103 |
104 | export default connect(mapStateToProps, mapDispatchToProps)(GistTable);
105 |
106 |
--------------------------------------------------------------------------------
/frontend/src/components/NavBar/ResponsiveAntMenu.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from "react";
2 | import { number, string, func, oneOfType, bool, oneOf } from "prop-types";
3 | import { Popover } from "antd";
4 | import throttle from "lodash.throttle";
5 |
6 | const ResponsiveAntMenu = (props) => {
7 | const {
8 | children: MenuMarkup, activeLinkKey, menuClassName: className,
9 | theme, mode, mobileMenuContent, placement, popoverTrigger,
10 | mobileBreakPoint, closeOnClick
11 | } = props;
12 |
13 | const [viewportWidth, setViewportWidth] = useState(0);
14 | const [isMenuShown, setIsMenuShown] = useState(false);
15 | const isMobile = () => viewportWidth < mobileBreakPoint;
16 | const onLinkClick = () => () => isMobile() && closeOnClick ? setIsMenuShown(false) : null;
17 |
18 | useEffect(() => {
19 | setViewportWidth(window.innerWidth);
20 | const throttledSetViewPortWidth = throttle(() => setViewportWidth(window.innerWidth));
21 | window.addEventListener("resize", throttledSetViewPortWidth);
22 |
23 | return () => window.removeEventListener("resize", throttledSetViewPortWidth);
24 | }, []);
25 |
26 | const menuMarkupConfig = {
27 | theme: !theme ? "dark" : typeof theme === "function" ? theme(isMobile()) : theme,
28 | mode: !mode ? "horizontal" : typeof mode === "function" ? mode(isMobile()) : mode,
29 | selectedKeys: [`${activeLinkKey}`],
30 | className,
31 | };
32 |
33 | const menuToRender = React.cloneElement(MenuMarkup(onLinkClick()), menuMarkupConfig);
34 |
35 | return isMobile() ?
36 |
43 | {mobileMenuContent(isMenuShown)}
44 | : menuToRender;
45 | };
46 |
47 | ResponsiveAntMenu.propTypes = {
48 | children: func.isRequired,
49 | mobileBreakPoint: number,
50 | closeOnMobileLinkClick: bool,
51 | activeLinkKey: string,
52 | placement: string,
53 | theme: func,
54 | mode: oneOfType([
55 | func,
56 | string
57 | ]),
58 | mobileMenuContent: func.isRequired,
59 | menuClassName: string,
60 | popoverTrigger: oneOf(["click", "hover", "focus"])
61 | };
62 |
63 | ResponsiveAntMenu.defaultProps = {
64 | mobileBreakPoint: 575,
65 | placement: "bottom",
66 | closeOnClick: true,
67 | popoverTrigger: "click",
68 | };
69 |
70 | export default ResponsiveAntMenu;
--------------------------------------------------------------------------------
/frontend/src/components/NavBar/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ResponsiveAntMenu from "./ResponsiveAntMenu";
3 | import { Menu } from "antd";
4 | import {
5 | GithubOutlined,
6 | } from "@ant-design/icons";
7 | import { connect } from "react-redux";
8 | import Cookies from "universal-cookie";
9 | const cookies = new Cookies();
10 |
11 | class NavBar extends React.Component {
12 | LogoutClickEvent = (e) => {
13 | e.preventDefault();
14 | cookies.remove("token", {path: "/", domain: `${process.env.REACT_APP_COOKIE_DOMAIN}`});
15 | window.location = "/";
16 | };
17 |
18 | AuthButton() {
19 | if(this.props.isLoggedInStatus){
20 | return (
21 |
22 | {// eslint-disable-next-line
23 | }Logout
24 |
25 | );
26 |
27 | }else {
28 | let GithubClientURL = `https://github.com/login/oauth/authorize?client_id=${process.env.REACT_APP_GITHUB_CLIENT_ID}&redirect_uri=${process.env.REACT_APP_API_ENDPOINT}/oauth/redirect`;
29 | /* eslint-disable */
30 | return (
31 |
32 | Login with github
33 |
34 | );
35 | }
36 | }
37 | render(){
38 | return (
39 | isMenuShown ? : }
41 | menuClassName={"responsive-ant-menu"}
42 | >
43 | {(onLinkClick) =>
44 |
50 | }
51 |
52 | );
53 | }
54 | }
55 |
56 | // https://stackoverflow.com/a/50225424
57 | const mapStateToProps = (state) => {
58 | return state.gistifyReducer;
59 | }
60 |
61 | const mapDispatchToProps = (dispatch) => {
62 | return {}
63 | }
64 |
65 | export default connect(mapStateToProps, mapDispatchToProps)(NavBar);
66 |
67 |
68 |
69 |
--------------------------------------------------------------------------------
/frontend/src/components/UploadGist/index.js:
--------------------------------------------------------------------------------
1 | import { Upload, Button, message, PageHeader } from "antd";
2 | import { UploadOutlined } from "@ant-design/icons";
3 | import { addGist } from "./../../redux/actions";
4 | import { connect } from "react-redux";
5 | import React from "react";
6 | import reqwest from "reqwest";
7 | import Cookies from "universal-cookie";
8 | const cookies = new Cookies();
9 |
10 |
11 | class UploadGist extends React.Component {
12 | state = {
13 | fileList: [],
14 | uploading: false,
15 | };
16 |
17 | handleUpload = () => {
18 | const { fileList } = this.state;
19 | const formData = new FormData();
20 | fileList.forEach(file => {
21 | formData.append("uploadfile", file, file.name);
22 | });
23 |
24 | this.setState({
25 | uploading: true,
26 | });
27 |
28 | // You can use any AJAX library you like
29 | let gistUrl = `${process.env.REACT_APP_API_ENDPOINT}/gists`;
30 | let jwtToken = cookies.get("token", {path: "/", domain: `${process.env.REACT_APP_COOKIE_DOMAIN}`});
31 | cookies.set("token", jwtToken, {path: "/", domain: `${process.env.REACT_APP_COOKIE_DOMAIN}`});
32 |
33 | reqwest({
34 | url: gistUrl,
35 | method: "post",
36 | headers: {
37 | "Authorization": `Bearer ${jwtToken}`
38 | },
39 | processData: false,
40 | data: formData,
41 | success: (resp) => {
42 | let gistID = resp.gistID;
43 | let url = `${process.env.REACT_APP_API_ENDPOINT}/gists/${gistID}`;
44 | let headers = new Headers();
45 | headers.append("Authorization", `Bearer ${jwtToken}`);
46 | let requestOptions = {
47 | method: "GET",
48 | headers,
49 | redirect: "follow"
50 | };
51 | fetch(url, requestOptions)
52 | .then(response => response.json())
53 | .then(result => this.props.addGist(result.gistData))
54 | .catch(error => console.log("error", error));
55 | this.setState({
56 | fileList: [],
57 | uploading: false,
58 | });
59 | message.success(resp.message);
60 | },
61 | error: () => {
62 | this.setState({
63 | uploading: false,
64 | });
65 | message.error("Conversion failed");
66 | },
67 | });
68 | };
69 |
70 | render() {
71 | const { uploading, fileList } = this.state;
72 | const props = {
73 | onRemove: file => {
74 | this.setState(state => {
75 | const index = state.fileList.indexOf(file);
76 | const newFileList = state.fileList.slice();
77 | newFileList.splice(index, 1);
78 | return {
79 | fileList: newFileList,
80 | };
81 | });
82 | },
83 | beforeUpload: file => {
84 | if(this.state.fileList<2){
85 | this.setState(state => ({
86 | fileList: [...state.fileList, file],
87 | }));
88 | }
89 | return false;
90 | },
91 | fileList,
92 | };
93 |
94 | return (
95 |
98 |
99 | }>Select File
100 |
101 |
110 |
111 | );
112 | }
113 | }
114 |
115 | // https://stackoverflow.com/a/50225424
116 | const mapStateToProps = (state) => {
117 | return state.gistifyReducer;
118 | };
119 |
120 | const mapDispatchToProps = (dispatch) => {
121 | return {
122 | addGist: (gist) => dispatch(addGist(gist)),
123 | };
124 | };
125 |
126 | export default connect(mapStateToProps, mapDispatchToProps)(UploadGist);
127 |
128 |
--------------------------------------------------------------------------------
/frontend/src/index.js:
--------------------------------------------------------------------------------
1 | import React from "react";
2 | import ReactDOM from "react-dom";
3 | import "antd/dist/antd.css";
4 | import { Provider } from "react-redux";
5 | // Step 5: Add the redux store to the React App
6 | import store from "./redux/store";
7 |
8 | import App from "./App";
9 |
10 | const rootElement = document.getElementById("root");
11 | ReactDOM.render(
12 |
13 |
14 | ,
15 | rootElement
16 | );
--------------------------------------------------------------------------------
/frontend/src/pages/Dashboard.js:
--------------------------------------------------------------------------------
1 | import { Redirect } from "react-router";
2 | import React from "react";
3 | import NavBar from "../components/NavBar";
4 | import UploadGist from "../components/UploadGist";
5 | import PageFooter from "../components/Footer";
6 | import GistTable from "../components/GistTable";
7 | import { Layout} from "antd";
8 | import Cookies from "universal-cookie";
9 | import { updateIsLoggedInStatus, updateUserId, updateUsername } from "./../redux/actions";
10 | import { connect } from "react-redux";
11 | import jwt_decode from "jwt-decode";
12 | const cookies = new Cookies();
13 | const { Content } = Layout;
14 |
15 | class Dashboard extends React.Component {
16 | dashboardPage(jwtToken){
17 | if(!jwtToken){
18 | return();
19 | }else{
20 | let decodedJwtToken = jwt_decode(jwtToken);
21 | this.props.updateIsLoggedInStatus(true);
22 | this.props.updateUserId(decodedJwtToken.userId);
23 | this.props.updateUsername(decodedJwtToken.username);
24 | return (
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | {this.props.isLoggedInStatus &&
33 |
34 | }
35 |
36 |
37 |
38 |
39 | );
40 | }
41 | }
42 | render(){
43 | return (
44 |
45 | {this.dashboardPage(cookies.get("token", {path: "/", domain: `${process.env.REACT_APP_COOKIE_DOMAIN}`}))}
46 |
47 | );
48 | }
49 | }
50 |
51 | // https://stackoverflow.com/a/50225424
52 | const mapStateToProps = (state) => {
53 | return state.gistifyReducer;
54 | };
55 |
56 | const mapDispatchToProps = (dispatch) => {
57 | return {
58 | updateIsLoggedInStatus: (isLoggedInStatus) => dispatch(updateIsLoggedInStatus(isLoggedInStatus)),
59 | updateUserId: (user_id) => dispatch(updateUserId(user_id)),
60 | updateUsername: (username) => dispatch(updateUsername(username)),
61 | };
62 | };
63 |
64 | export default connect(mapStateToProps, mapDispatchToProps)(Dashboard);
65 |
66 |
--------------------------------------------------------------------------------
/frontend/src/pages/Login.js:
--------------------------------------------------------------------------------
1 | import Cookies from "universal-cookie";
2 | import jwt_decode from "jwt-decode";
3 | import { Redirect } from "react-router";
4 | import React from "react";
5 | import NavBar from "../components/NavBar";
6 | import UploadGist from "../components/UploadGist";
7 | import PageFooter from "../components/Footer";
8 | import { connect } from "react-redux";
9 | import { Layout} from "antd";
10 | const { Content } = Layout;
11 |
12 | const cookies = new Cookies();
13 |
14 | class Login extends React.Component {
15 | loginPage(jwtToken){
16 | if(!jwtToken){
17 | return(
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | );
28 | }else{
29 | let decodedJwtToken = jwt_decode(jwtToken);
30 | const redirectURL = "/"+decodedJwtToken.username;
31 | return();
32 | }
33 | }
34 | render(){
35 | return (
36 |
37 | {this.loginPage(cookies.get("token", {path: "/", domain: `${process.env.REACT_APP_COOKIE_DOMAIN}`}))}
38 |
39 | );
40 | }
41 | }
42 |
43 | // https://stackoverflow.com/a/50225424
44 | const mapStateToProps = (state) => {
45 | return state.gistifyReducer;
46 | };
47 |
48 | const mapDispatchToProps = (dispatch) => {
49 | return {};
50 | };
51 |
52 | export default connect(mapStateToProps, mapDispatchToProps)(Login);
--------------------------------------------------------------------------------
/frontend/src/redux/actionTypes.js:
--------------------------------------------------------------------------------
1 | // Step 1: Create Action Types
2 | export const UPDATE_IS_LOGGED_IN_STATUS = "UPDATE_IS_LOGGED_IN_STATUS";
3 | export const UPDATE_USER_ID = "UPDATE_USER_ID";
4 | export const UPDATE_USERNAME = "UPDATE_USERNAME";
5 | export const UPDATE_GISTS = "UPDATE_GISTS";
6 | export const ADD_GIST = "ADD_GIST";
--------------------------------------------------------------------------------
/frontend/src/redux/actions.js:
--------------------------------------------------------------------------------
1 | // Step 2: Create Actions for your Action Types
2 |
3 | import {UPDATE_IS_LOGGED_IN_STATUS, UPDATE_USER_ID, UPDATE_USERNAME, UPDATE_GISTS, ADD_GIST} from "./actionTypes";
4 |
5 | export const updateIsLoggedInStatus = (isLoggedInStatus) => {
6 | return {
7 | type: UPDATE_IS_LOGGED_IN_STATUS,
8 | payload: {isLoggedInStatus}
9 | };
10 | };
11 |
12 | export const updateUserId = (userId) => {
13 | return {
14 | type: UPDATE_USER_ID,
15 | payload: {userId}
16 | };
17 | };
18 |
19 | export const updateUsername = (username) => {
20 | return {
21 | type: UPDATE_USERNAME,
22 | payload: {username}
23 | };
24 | };
25 |
26 | export const updateGists = (gists) => {
27 | return {
28 | type: UPDATE_GISTS,
29 | payload: {gists}
30 | };
31 | };
32 |
33 | export const addGist = (gist) => {
34 | return {
35 | type: ADD_GIST,
36 | payload: {gist}
37 | };
38 | };
39 |
40 |
--------------------------------------------------------------------------------
/frontend/src/redux/reducers/gistifyReducer.js:
--------------------------------------------------------------------------------
1 | // Step 3: Create reducers for the action types
2 | import {UPDATE_IS_LOGGED_IN_STATUS, UPDATE_USER_ID, UPDATE_USERNAME, UPDATE_GISTS, ADD_GIST} from "../actionTypes";
3 |
4 | const initialState = {
5 | isLoggedInStatus: false,
6 | userId : "",
7 | username: "",
8 | gists: []
9 | };
10 |
11 | const gistifyReducer = (state=initialState, actions) => {
12 | switch(actions.type) {
13 | case UPDATE_IS_LOGGED_IN_STATUS:
14 | return {...state, isLoggedInStatus: actions.payload.isLoggedInStatus};
15 | case UPDATE_USER_ID:
16 | return {...state, userId: actions.payload.userId};
17 | case UPDATE_USERNAME:
18 | return {...state, username: actions.payload.username};
19 | case UPDATE_GISTS:
20 | return {...state, gists: [...actions.payload.gists]};
21 | case ADD_GIST:
22 | let gist = actions.payload.gist;
23 | if (Object.keys(gist).length){
24 | let gists = state.gists;
25 | return {...state, gists: [gist, ...gists]};
26 | }else{
27 | return {...state, gists: [...state.gists]};
28 | }
29 | default:
30 | return {...state};
31 | }
32 | };
33 |
34 | export default gistifyReducer;
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/frontend/src/redux/reducers/index.js:
--------------------------------------------------------------------------------
1 | // Step 3: Create reducers for the action types
2 |
3 | import { combineReducers } from "redux";
4 |
5 | import gistifyReducer from "./gistifyReducer";
6 |
7 | export default combineReducers({ gistifyReducer });
--------------------------------------------------------------------------------
/frontend/src/redux/store.js:
--------------------------------------------------------------------------------
1 | // Step 4: Add all the reducers to the redux store.
2 |
3 | import { createStore } from "redux";
4 | import rootReducer from "./reducers";
5 |
6 |
7 | export default createStore(rootReducer,
8 | window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());
--------------------------------------------------------------------------------
/helm/Chart.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v2
2 | appVersion: "1.0"
3 | description: Helm chart for gistify app
4 | name: gistify
5 | owner: dineshsonachalam
6 | version: 0.1.0
7 |
--------------------------------------------------------------------------------
/helm/templates/gistify-backend/deployment.yaml:
--------------------------------------------------------------------------------
1 | # 1. Deployment
2 | apiVersion: apps/v1
3 | kind: Deployment
4 | metadata:
5 | labels:
6 | app: {{ .Values.gistifyBackend.appName }}
7 | name: {{ .Values.gistifyBackend.appName }}
8 | namespace: {{ .Values.namespace }}
9 | spec:
10 | replicas: {{ .Values.replicas }}
11 | selector:
12 | matchLabels:
13 | app: {{ .Values.gistifyBackend.appName }}
14 | template:
15 | metadata:
16 | labels:
17 | app: {{ .Values.gistifyBackend.appName }}
18 | spec:
19 | containers:
20 | - name: {{ .Values.gistifyBackend.appName }}
21 | image: {{ .Values.gistifyBackend.image }}
22 | imagePullPolicy: Always
23 | env:
24 | - name: GISTIFY_APP_ENV
25 | valueFrom:
26 | secretKeyRef:
27 | name: {{ .Values.gistifyBackendSecrets.appName }}
28 | key: GISTIFY_APP_ENV
29 |
30 | - name: GISTIFY_PROD_APP_URL
31 | valueFrom:
32 | secretKeyRef:
33 | name: {{ .Values.gistifyBackendSecrets.appName }}
34 | key: GISTIFY_PROD_APP_URL
35 |
36 | - name: GISTIFY_PROD_GITHUB_CLIENT_ID
37 | valueFrom:
38 | secretKeyRef:
39 | name: {{ .Values.gistifyBackendSecrets.appName }}
40 | key: GISTIFY_PROD_GITHUB_CLIENT_ID
41 |
42 | - name: GISTIFY_PROD_GITHUB_CLIENT_SECRET
43 | valueFrom:
44 | secretKeyRef:
45 | name: {{ .Values.gistifyBackendSecrets.appName }}
46 | key: GISTIFY_PROD_GITHUB_CLIENT_SECRET
47 |
48 | - name: GISTIFY_PROD_JWT_SECRET_KEY
49 | valueFrom:
50 | secretKeyRef:
51 | name: {{ .Values.gistifyBackendSecrets.appName }}
52 | key: GISTIFY_PROD_JWT_SECRET_KEY
53 |
54 | - name: GISTIFY_PROD_GIST_API_TOKEN
55 | valueFrom:
56 | secretKeyRef:
57 | name: {{ .Values.gistifyBackendSecrets.appName }}
58 | key: GISTIFY_PROD_GIST_API_TOKEN
59 | ports:
60 | - containerPort: {{ .Values.gistifyBackend.containerPort }}
61 | name: {{ .Values.gistifyBackend.appName }}
62 |
--------------------------------------------------------------------------------
/helm/templates/gistify-backend/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: traefik.containo.us/v1alpha1
2 | kind: IngressRoute
3 | metadata:
4 | name: {{ .Values.gistifyBackend.appName }}
5 | namespace: {{ .Values.namespace }}
6 | spec:
7 | entryPoints:
8 | - web
9 | routes:
10 | - match: {{ .Values.gistifyBackend.ingressRoute }}
11 | kind: Rule
12 | services:
13 | - name: {{ .Values.gistifyBackend.appName }}
14 | port: {{ .Values.gistifyBackend.containerPort }}
--------------------------------------------------------------------------------
/helm/templates/gistify-backend/secrets.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Secret
3 | metadata:
4 | name: {{ .Values.gistifyBackendSecrets.appName }}
5 | namespace: {{ .Values.namespace }}
6 | type: Opaque
7 | stringData:
8 | GISTIFY_APP_ENV: {{ .Values.gistifyBackendSecrets.GISTIFY_APP_ENV }}
9 | GISTIFY_PROD_APP_URL: {{ .Values.gistifyBackendSecrets.GISTIFY_PROD_APP_URL }}
10 | GISTIFY_PROD_GITHUB_CLIENT_ID: {{ .Values.gistifyBackendSecrets.GISTIFY_PROD_GITHUB_CLIENT_ID }}
11 | GISTIFY_PROD_GITHUB_CLIENT_SECRET: {{ .Values.gistifyBackendSecrets.GISTIFY_PROD_GITHUB_CLIENT_SECRET }}
12 | GISTIFY_PROD_JWT_SECRET_KEY: {{ .Values.gistifyBackendSecrets.GISTIFY_PROD_JWT_SECRET_KEY }}
13 | GISTIFY_PROD_GIST_API_TOKEN: {{ .Values.gistifyBackendSecrets.GISTIFY_PROD_GIST_API_TOKEN }}
--------------------------------------------------------------------------------
/helm/templates/gistify-backend/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.gistifyBackend.appName }}
5 | namespace: {{ .Values.namespace }}
6 | spec:
7 | ports:
8 | - protocol: TCP
9 | name: web
10 | port: {{ .Values.gistifyBackend.containerPort }}
11 | selector:
12 | app: {{ .Values.gistifyBackend.appName }}
--------------------------------------------------------------------------------
/helm/templates/gistify-frontend/deployment.yaml:
--------------------------------------------------------------------------------
1 | # 1. Deployment
2 | apiVersion: apps/v1
3 | kind: Deployment
4 | metadata:
5 | labels:
6 | app: {{ .Values.gistifyFrontend.appName }}
7 | name: {{ .Values.gistifyFrontend.appName }}
8 | namespace: {{ .Values.namespace }}
9 | spec:
10 | replicas: {{ .Values.replicas }}
11 | selector:
12 | matchLabels:
13 | app: {{ .Values.gistifyFrontend.appName }}
14 | template:
15 | metadata:
16 | labels:
17 | app: {{ .Values.gistifyFrontend.appName }}
18 | spec:
19 | containers:
20 | - name: {{ .Values.gistifyFrontend.appName }}
21 | image: {{ .Values.gistifyFrontend.image }}
22 | imagePullPolicy: Always
23 | ports:
24 | - containerPort: {{ .Values.gistifyFrontend.containerPort }}
25 | name: {{ .Values.gistifyFrontend.appName }}
26 |
--------------------------------------------------------------------------------
/helm/templates/gistify-frontend/ingress.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: traefik.containo.us/v1alpha1
2 | kind: IngressRoute
3 | metadata:
4 | name: {{ .Values.gistifyFrontend.appName }}
5 | namespace: {{ .Values.namespace }}
6 | spec:
7 | entryPoints:
8 | - web
9 | routes:
10 | - match: {{ .Values.gistifyFrontend.ingressRoute }}
11 | kind: Rule
12 | services:
13 | - name: {{ .Values.gistifyFrontend.appName }}
14 | port: {{ .Values.gistifyFrontend.containerPort }}
--------------------------------------------------------------------------------
/helm/templates/gistify-frontend/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.gistifyFrontend.appName }}
5 | namespace: {{ .Values.namespace }}
6 | spec:
7 | ports:
8 | - protocol: TCP
9 | name: web
10 | port: {{ .Values.gistifyFrontend.containerPort }}
11 | selector:
12 | app: {{ .Values.gistifyFrontend.appName }}
--------------------------------------------------------------------------------
/helm/templates/postgres/service.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: v1
2 | kind: Service
3 | metadata:
4 | name: {{ .Values.postgres.appName }}
5 | namespace: {{ .Values.namespace }}
6 | labels:
7 | app: {{ .Values.postgres.appName }}
8 | spec:
9 | ports:
10 | - port: {{ .Values.postgres.containerPort }}
11 | name: web
12 | selector:
13 | app: {{ .Values.postgres.appName }}
--------------------------------------------------------------------------------
/helm/templates/postgres/statefulset.yaml:
--------------------------------------------------------------------------------
1 | apiVersion: apps/v1
2 | kind: StatefulSet
3 | metadata:
4 | name: {{ .Values.postgres.appName }}
5 | namespace: {{ .Values.namespace }}
6 | spec:
7 | selector:
8 | matchLabels:
9 | app: {{ .Values.postgres.appName }}
10 | serviceName: {{ .Values.postgres.appName }}
11 | replicas: {{ .Values.replicas }}
12 | template:
13 | metadata:
14 | labels:
15 | app: {{ .Values.postgres.appName }} # has to match .spec.selector.matchLabels
16 | spec:
17 | terminationGracePeriodSeconds: 10
18 | initContainers:
19 | - name: init-sysctl
20 | image: busybox
21 | imagePullPolicy: IfNotPresent
22 | command: ["/bin/sh","-c"]
23 | args: ["sysctl -w vm.max_map_count=262144; chown -R 1000:1000 {{ .Values.postgres.volumeMountsPath }}"]
24 | securityContext:
25 | privileged: true
26 | volumeMounts:
27 | - name: {{ .Values.postgres.volumeMountsName }}
28 | mountPath: {{ .Values.postgres.volumeMountsPath }}
29 | containers:
30 | - name: {{ .Values.postgres.appName }}
31 | image: {{ .Values.postgres.image }}
32 | env:
33 | - name: POSTGRES_USER
34 | value: "dinesh"
35 | - name: POSTGRES_PASSWORD
36 | value: "simple"
37 | - name: POSTGRES_DB
38 | value: "dinesh-micro-apps"
39 | ports:
40 | - containerPort: {{ .Values.postgres.containerPort }}
41 | name: {{ .Values.postgres.appName }}
42 | volumeMounts:
43 | - name: {{ .Values.postgres.volumeMountsName }}
44 | mountPath: {{ .Values.postgres.volumeMountsPath }}
45 | volumeClaimTemplates:
46 | - metadata:
47 | name: {{ .Values.postgres.volumeMountsName }}
48 | spec:
49 | accessModes: [ "ReadWriteOnce" ]
50 | resources:
51 | requests:
52 | storage: 5Gi
53 |
--------------------------------------------------------------------------------
/helm/values.yaml:
--------------------------------------------------------------------------------
1 | namespace: dinesh
2 | replicas: 1
3 |
4 | postgres:
5 | image: postgres:9.6.21
6 | containerPort: 5432
7 | appName: postgres
8 | volumeMountsName: postgres-data
9 | volumeMountsPath: /data/pgdata
10 |
11 | gistifyBackend:
12 | image: dineshsonachalam/gistify-backend:latest
13 | containerPort: 8003
14 | appName: gistify-api
15 | ingressRoute: (Host(`api--gistify.dineshsonachalam.com`))
16 |
17 | gistifyBackendSecrets:
18 | appName: gistify-secrets
19 | GISTIFY_APP_ENV: "PROD"
20 | GISTIFY_PROD_APP_URL: "https://gistify.dineshsonachalam.com/"
21 | GISTIFY_PROD_GITHUB_CLIENT_ID: "${GISTIFY_PROD_GITHUB_CLIENT_ID}"
22 | GISTIFY_PROD_GITHUB_CLIENT_SECRET: "${GISTIFY_PROD_GITHUB_CLIENT_SECRET}"
23 | GISTIFY_PROD_JWT_SECRET_KEY: "${GISTIFY_PROD_JWT_SECRET_KEY}"
24 | GISTIFY_PROD_GIST_API_TOKEN: "${GISTIFY_PROD_GIST_API_TOKEN}"
25 |
26 | gistifyFrontend:
27 | image: dineshsonachalam/gistify-frontend:latest
28 | containerPort: 3000
29 | appName: gistify-ui
30 | ingressRoute: (Host(`gistify.dineshsonachalam.com`))
31 |
--------------------------------------------------------------------------------
/sonar-project.properties:
--------------------------------------------------------------------------------
1 | sonar.projectKey=gistify
2 | sonar.organization=dineshsonachalam
3 |
4 | # This is the name and version displayed in the SonarCloud UI.
5 | sonar.projectName=gistify
6 | sonar.projectVersion=1.0
7 |
8 | # Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
9 | sonar.sources=.
10 |
11 | # Encoding of the source code. Default is default system encoding
12 | sonar.sourceEncoding=UTF-8
--------------------------------------------------------------------------------
/test_docs/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dineshsonachalam/gistify/511f241251c1395899c80baf8d30eeaa777894bc/test_docs/.DS_Store
--------------------------------------------------------------------------------
/test_docs/dev-salaries.csv:
--------------------------------------------------------------------------------
1 | Timestamp,Employer,Location,Job Title,Years at Employer,Years of Experience,Annual Base Pay,Signing Bonus,Annual Bonus,Annual Stock Value/Bonus,Gender,Additional Comments
2 | 21/5/2020,Apple,Cupertino,Software Engineer,3,4,110000,5000,7000,150000,Male,"Great co-workers, good work life balance"
3 | 21/5/2020,Amazon,Seattle,Software Development Engineer,1,0,95000,22000,20000,52000,Male,Generous vacation benefits and solid health benefits
4 | 21/5/2020,Amplify,NYC,Software Engineer,1,2,105000,0,47000,0,Male,Good work-life balance
5 | 21/5/2020,Walmart,"Bentonville, AR",Senior Developer,8,15,"65,000",0,"5,000","3,000",Male,Good benefits
6 | 21/5/2020,Twilio,San Francisco,Software Engineer New Grad,1,1,"1,15,000","10,000",0,~80k options,Male,Good work culture
--------------------------------------------------------------------------------
/test_docs/dev-salaries.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dineshsonachalam/gistify/511f241251c1395899c80baf8d30eeaa777894bc/test_docs/dev-salaries.xlsx
--------------------------------------------------------------------------------
/test_docs/docker-compose.yaml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | elasticsearch:
4 | image: "docker.elastic.co/elasticsearch/elasticsearch:7.12.0"
5 | networks:
6 | - frontend
7 | restart: always
8 | volumes:
9 | - ./ES_DATA:/usr/share/elasticsearch/data
10 | environment:
11 | - discovery.type=single-node
12 | ports:
13 | - "9200:9200"
14 | healthcheck:
15 | test: ["CMD", "curl","-s" ,"-f", "http://localhost:9200/_cat/health"]
16 | retries: 6
17 |
18 | backend:
19 | image: "dineshsonachalam/gistify-backend:latest"
20 | environment:
21 | - PYTHONUNBUFFERED=1
22 | networks:
23 | - frontend
24 | ports:
25 | - "8000:8000"
26 | depends_on:
27 | - elasticsearch
28 | networks:
29 | frontend:
30 |
31 |
--------------------------------------------------------------------------------
/test_docs/traefik.toml:
--------------------------------------------------------------------------------
1 | ################################################################
2 | #
3 | # Configuration sample for Traefik v2.
4 | #
5 | # For Traefik v1: https://github.com/containous/traefik/blob/v1.7/traefik.sample.toml
6 | #
7 | ################################################################
8 |
9 | ################################################################
10 | # Global configuration
11 | ################################################################
12 | [global]
13 | checkNewVersion = true
14 | sendAnonymousUsage = true
15 |
16 | ################################################################
17 | # Entrypoints configuration
18 | ################################################################
19 |
20 | [serversTransport]
21 | insecureSkipVerify = true
22 |
23 | # Entrypoints definition
24 | #
25 | # Optional
26 | # Default:
27 | [entryPoints]
28 | [entryPoints.web]
29 | address = ":80"
30 |
31 | [entryPoints.websecure]
32 | address = ":443"
33 |
34 | [certificatesResolvers.le.acme]
35 | # Be sure to change this to a valid email address, otherwise you might miss out on expiry notices!
36 | email = "myemail@domaindomaindomain.com"
37 | storage = "/etc/traefik/acme.json"
38 | [certificatesResolvers.le.acme.httpChallenge]
39 | # used during the challenge
40 | entryPoint = "web"
41 |
42 | ################################################################
43 | # Traefik logs configuration
44 | ################################################################
45 |
46 | # Traefik logs
47 | # Enabled by default and log to stdout
48 | #
49 | # Optional
50 | #
51 | [log]
52 |
53 | # Log level
54 | #
55 | # Optional
56 | # Default: "ERROR"
57 | #
58 | # level = "DEBUG"
59 |
60 | # Sets the filepath for the traefik log. If not specified, stdout will be used.
61 | # Intermediate directories are created if necessary.
62 | #
63 | # Optional
64 | # Default: os.Stdout
65 | #
66 | filePath = "/etc/traefik/log/traefik.log"
67 |
68 | # Format is either "json" or "common".
69 | #
70 | # Optional
71 | # Default: "common"
72 | #
73 | # format = "json"
74 |
75 | ################################################################
76 | # Access logs configuration
77 | ################################################################
78 |
79 | # Enable access logs
80 | # By default it will write to stdout and produce logs in the textual
81 | # Common Log Format (CLF), extended with additional fields.
82 | #
83 | # Optional
84 | #
85 | # [accessLog]
86 |
87 | # Sets the file path for the access log. If not specified, stdout will be used.
88 | # Intermediate directories are created if necessary.
89 | #
90 | # Optional
91 | # Default: os.Stdout
92 | #
93 | # filePath = "/path/to/log/log.txt"
94 |
95 | # Format is either "json" or "common".
96 | #
97 | # Optional
98 | # Default: "common"
99 | #
100 | # format = "json"
101 |
102 | ################################################################
103 | # API and dashboard configuration
104 | ################################################################
105 |
106 | # Enable API and dashboard
107 | [api]
108 | insecure = true
109 | dashboard = true
110 |
111 | ################################################################
112 | # Ping configuration
113 | ################################################################
114 |
115 | # Enable ping
116 | [ping]
117 |
118 | # Name of the related entry point
119 | #
120 | # Optional
121 | # Default: "traefik"
122 | #
123 | # entryPoint = "traefik"
124 |
125 | ################################################################
126 | # Docker configuration backend
127 | ################################################################
128 |
129 | # Enable Docker configuration backend
130 | [providers.docker]
131 | endpoint = "unix:///var/run/docker.sock"
132 | exposedByDefault = true
133 | watch = true
134 | defaultRule = "Host(`{{ normalize .Name }}.your-fqdn.com`)"
135 |
136 | [providers.file]
137 | directory = "/etc/traefik/providers/file"
138 | watch = true
--------------------------------------------------------------------------------