Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iter14 #14

Open
wants to merge 56 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
6d6a53e
Add Get and Post handlers with simple storage
shilin-anton Feb 6, 2024
99b61eb
Update responses
shilin-anton Feb 7, 2024
dd4b6c8
Fix WriteReader order
shilin-anton Feb 7, 2024
0cddb61
Change project structure and add tests
shilin-anton Feb 9, 2024
7b0b190
Close body in a test
shilin-anton Feb 9, 2024
491b1e7
Move body.close before Result
shilin-anton Feb 9, 2024
c146465
Add defer on body closing
shilin-anton Feb 9, 2024
e4bd004
Add chi usage, Change tests
shilin-anton Feb 10, 2024
86ff933
Remove unnecessary storage creation
shilin-anton Feb 10, 2024
d6a19a0
Add config to handle flags
shilin-anton Feb 11, 2024
8fcb776
FIx run address
shilin-anton Feb 11, 2024
e595f4c
Fix host
shilin-anton Feb 11, 2024
f4296de
Add prefix on save short link
shilin-anton Feb 11, 2024
06c9355
FIx
shilin-anton Feb 11, 2024
53def49
Add ENV params
shilin-anton Feb 12, 2024
809a583
Fixes after review
shilin-anton Mar 19, 2024
b3b87b4
Add logger
shilin-anton Mar 20, 2024
37ec342
Fix linter offences
shilin-anton Mar 20, 2024
68bc72e
Add /shorten json handler and test
shilin-anton Mar 25, 2024
0b79cd2
Fix struct key
shilin-anton Mar 25, 2024
e4d5a71
Fix route
shilin-anton Mar 25, 2024
050e81a
Add gzip middleware
shilin-anton Mar 26, 2024
8597962
Add file-manager to control local file storage
shilin-anton Mar 27, 2024
914a918
Fix linter offences
shilin-anton Mar 27, 2024
ac7ff68
Remove unused types from logger
shilin-anton Apr 1, 2024
8a18246
Replace storage import by interface in fileManager
shilin-anton Apr 1, 2024
4f0ae4b
Temp commit
shilin-anton Apr 1, 2024
156fe72
Refactor code
shilin-anton Apr 1, 2024
0b79f63
More refactor
shilin-anton Apr 2, 2024
5db583b
Add psql
shilin-anton May 6, 2024
2659eff
Fix handler test
shilin-anton May 6, 2024
5dacc74
Fix linter offences
shilin-anton May 6, 2024
9ba98e7
Unwrap gzip middleware
shilin-anton May 6, 2024
49f4b1e
Change default DSN
shilin-anton May 6, 2024
e4cf49f
Refactor and add db mock
shilin-anton May 6, 2024
d95a08c
Add database storage
shilin-anton May 7, 2024
6ccac89
commented default DSN
shilin-anton May 7, 2024
b4f5389
Revert default DSN
shilin-anton May 7, 2024
e1ddc2c
Remove default DSN
shilin-anton May 7, 2024
7e53f33
Change var name
shilin-anton May 7, 2024
4870d3e
Add table creation if not exists
shilin-anton May 7, 2024
0abe909
Add err handling
shilin-anton May 7, 2024
39b1b52
Add db context and fix storage creation
shilin-anton May 7, 2024
77779bc
Add /shorten/batch and batch store handling
shilin-anton May 8, 2024
c02ff35
Fix linter offences
shilin-anton May 8, 2024
59c29e0
Add id handling on DB store
shilin-anton May 8, 2024
42f1028
Fix batch response
shilin-anton May 17, 2024
b8ccb65
Add not unique error handling
shilin-anton May 20, 2024
7f75e90
Revert gzip wrapper
shilin-anton May 20, 2024
628095c
Add /urls handler
shilin-anton May 23, 2024
0391861
Add user id
shilin-anton May 24, 2024
260f9cc
fix vet test
shilin-anton May 24, 2024
b7baf56
Add token handling
shilin-anton May 24, 2024
a9b095f
fix test
shilin-anton May 24, 2024
44ac41f
Fix 12iter
shilin-anton May 25, 2024
925dffc
Add missing import
shilin-anton May 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ vendor/
# IDEs directories
.idea
.vscode
cmd/.DS_Store
.DS_Store
/tmp
37 changes: 36 additions & 1 deletion cmd/shortener/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
package main

func main() {}
import (
_ "github.com/jackc/pgx/v5/stdlib"
"github.com/shilin-anton/urlreducer/internal/app/config"
filemanager "github.com/shilin-anton/urlreducer/internal/app/file-manager"
handler "github.com/shilin-anton/urlreducer/internal/app/handlers"
"github.com/shilin-anton/urlreducer/internal/app/storage"
"github.com/shilin-anton/urlreducer/internal/logger"
"log"
"net/http"
)

func main() {
config.ParseConfig()
err := logger.Initialize(config.LogLevel)
if err != nil {
log.Fatal("Error initializing logger", err.Error())
}

var fl *filemanager.ExportedManager
if config.FilePath != "" {
fl = filemanager.New()
}

var db *storage.DataBase
if config.DBDSN != "" {
db, err = storage.NewDB(config.DBDSN)
if err != nil {
log.Fatal("Error initializing DB: ", err.Error())
}
defer db.Close()
}

myStorage := storage.New(fl, db)
myHandler := handler.New(myStorage)
log.Fatal(http.ListenAndServe(config.RunAddr, myHandler))
}
27 changes: 27 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module github.com/shilin-anton/urlreducer

go 1.21.3

require (
github.com/go-chi/chi/v5 v5.0.11
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang/mock v1.6.0
github.com/google/uuid v1.6.0
github.com/jackc/pgx/v5 v5.5.5
github.com/stretchr/testify v1.8.1
go.uber.org/zap v1.27.0
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/text v0.14.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
77 changes: 77 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-chi/chi/v5 v5.0.11 h1:BnpYbFZ3T3S1WMpD79r7R5ThWX40TaFB7L31Y8xqSwA=
github.com/go-chi/chi/v5 v5.0.11/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
github.com/golang-jwt/jwt/v4 v4.5.0 h1:7cYmW1XlMY7h7ii7UhUyChSgS5wUJEnm9uZVTGqOWzg=
github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0=
github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM=
github.com/jackc/pgx/v5 v5.5.5 h1:amBjrZVmksIdNjxGW/IiIMzxMKZFelXbUoPNb+8sjQw=
github.com/jackc/pgx/v5 v5.5.5/go.mod h1:ez9gk+OAat140fv9ErkZDYFWmXLfV+++K0uAOiwgm1A=
github.com/jackc/puddle/v2 v2.2.1 h1:RhxXJtFG022u4ibrCSMSiu5aOq1i77R3OHKNJj77OAk=
github.com/jackc/puddle/v2 v2.2.1/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8=
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE=
go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
99 changes: 99 additions & 0 deletions internal/app/auth/auth.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
package auth

import (
"errors"
"github.com/golang-jwt/jwt/v4"
"github.com/google/uuid"
"github.com/shilin-anton/urlreducer/internal/app/config"
"net/http"
"time"
)

const CookieName = "jwt_token"
const JWTHeader = "JWT"

type Claims struct {
jwt.RegisteredClaims
UserID string
}

func Signup(handler http.HandlerFunc) http.HandlerFunc {
return func(res http.ResponseWriter, req *http.Request) {
var userID string
cookie, err := req.Cookie(CookieName)
if err != nil {
if errors.Is(err, http.ErrNoCookie) {
userID, err = generateCookie(res)
if err != nil {
http.Error(res, err.Error(), http.StatusInternalServerError)
}
} else {
http.Error(res, err.Error(), http.StatusInternalServerError)
}
} else {
tokenString := cookie.Value
userID, err = GetUserID(tokenString)
if err != nil {
userID, err = generateCookie(res)
if err != nil {
http.Error(res, err.Error(), http.StatusInternalServerError)
return
}
}
}

req.Header.Set(JWTHeader, userID)
handler(res, req)
}
}

func generateCookie(res http.ResponseWriter) (string, error) {
userID := uuid.New().String()

tokenString, err := buildJWTString(userID)
if err != nil {
return "", err
}

newCookie := http.Cookie{
Name: CookieName,
Value: tokenString,
}
http.SetCookie(res, &newCookie)
return userID, nil
}

func buildJWTString(userID string) (string, error) {
token := jwt.NewWithClaims(jwt.SigningMethodHS256, Claims{
RegisteredClaims: jwt.RegisteredClaims{
ExpiresAt: jwt.NewNumericDate(time.Now().Add(config.JWTExp)),
},
UserID: userID,
})

tokenString, err := token.SignedString([]byte(config.JWTSecret))
if err != nil {
return "", err
}

return tokenString, nil
}

func GetUserID(tokenString string) (string, error) {
claims := &Claims{}
token, err := jwt.ParseWithClaims(tokenString, claims,
func(t *jwt.Token) (interface{}, error) {
if _, ok := t.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, jwt.ErrTokenNotValidYet
}
return []byte(config.JWTSecret), nil
})
if err != nil {
return "", err
}

if !token.Valid {
return "", jwt.ErrTokenNotValidYet
}
return claims.UserID, nil
}
56 changes: 56 additions & 0 deletions internal/app/config/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package config

import (
"flag"
"os"
"time"
)

var RunAddr string
var BaseAddr string
var LogLevel string
var FilePath string
var DBDSN string
var JWTSecret string
var JWTExp time.Duration

const (
defaultRunURL = "localhost:8080"
defaultBaseURL = "http://localhost:8080"
defaultLogLevel = "info"
defaultFilePath = "/tmp/short-url-db.json"
//defaultFilePath = ""
//defaultDSN = "host=127.0.0.1 user=postgres dbname=shortener sslmode=disable"
defaultDSN = ""
jwtSecret = "verysecretshit"
jwtExp = 3 * time.Hour
)

func ParseConfig() {
flag.StringVar(&RunAddr, "a", defaultRunURL, "address and port to run server")
flag.StringVar(&BaseAddr, "b", defaultBaseURL, "base URL before short link")
flag.StringVar(&LogLevel, "l", defaultLogLevel, "log level")
flag.StringVar(&FilePath, "f", defaultFilePath, "file storage path")
flag.StringVar(&DBDSN, "d", defaultDSN, "database DSN")

flag.Parse()

if envRunAddr := os.Getenv("SERVER_ADDRESS"); envRunAddr != "" {
RunAddr = envRunAddr
}
if envBaseAddr := os.Getenv("BASE_URL"); envBaseAddr != "" {
BaseAddr = envBaseAddr
}
if envLogLevel := os.Getenv("LOG_LEVEL"); envLogLevel != "" {
LogLevel = envLogLevel
}
if envFilePath := os.Getenv("FILE_STORAGE_PATH"); envFilePath != "" {
FilePath = envFilePath
}
if envDSN := os.Getenv("DATABASE_DSN"); envDSN != "" {
DBDSN = envDSN
}

JWTSecret = jwtSecret
JWTExp = jwtExp
}
Loading
Loading