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

Development #37

Merged
merged 22 commits into from
Apr 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
fc304ca
chore(deps): update all minor updates
renovate[bot] Mar 4, 2024
8978f1f
Merge pull request #23 from B-urb/renovate/all-minor
B-urb Mar 7, 2024
9583a1c
ci: fix docker build
Mar 7, 2024
7ff2188
fix(deps): update module gorm.io/driver/postgres to v1.5.7
renovate[bot] Mar 9, 2024
1f22e38
style: fix linting errors
Mar 12, 2024
9311695
Merge branch 'development' of github.com:B-urb/KubeVoyage into develo…
Mar 12, 2024
2655708
fix(deps): update module github.com/golang-jwt/jwt/v5 to v5.2.1
renovate[bot] Mar 12, 2024
f8b7000
chore(deps): update all minor updates
renovate[bot] Mar 12, 2024
6719475
Merge pull request #27 from B-urb/renovate/all-minor
B-urb Mar 12, 2024
da5f904
fix(deps): update module gorm.io/driver/mysql to v1.5.5
renovate[bot] Mar 18, 2024
2cd8819
fix(deps): update module gorm.io/gorm to v1.25.8
renovate[bot] Mar 18, 2024
6ecd8f5
fix(deps): update module gorm.io/driver/mysql to v1.5.6
renovate[bot] Mar 21, 2024
88055e0
chore(deps): update dependency rollup to v4.13.1
renovate[bot] Mar 27, 2024
528d605
fix(deps): update module gorm.io/gorm to v1.25.9
renovate[bot] Mar 28, 2024
82e8425
chore(deps): update dependency rollup to v4.13.2
renovate[bot] Mar 28, 2024
c2718c2
chore(deps): update dependency rollup to v4.14.0
renovate[bot] Apr 3, 2024
c501a03
Merge pull request #34 from B-urb/renovate/all-minor
B-urb Apr 3, 2024
dbc9f5f
fix(frontend): update login redirect param
Apr 6, 2024
6ef6b2c
fix(backend): make frontend path dynamic
Apr 6, 2024
92e3671
Merge remote-tracking branch 'origin/development' into development
Apr 6, 2024
13a1024
fix(backend): attempt to fix bad gateway
Apr 6, 2024
30867b3
chore(deps): update dependency rollup to v4.14.1
renovate[bot] Apr 7, 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
6 changes: 3 additions & 3 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
- development
pull_request:
branches:
- '*'
- 'master'

env:
CI: true
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
build-docker:
needs: build
runs-on: ubuntu-latest
if: ${{ github.ref }} != 'master' && ${{ github.ref }} != 'development'
if: ${{ github.ref }} == 'master' || ${{ github.ref }} == 'development'
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
steps:
Expand Down Expand Up @@ -139,7 +139,7 @@ jobs:
git config user.email "[email protected]"

- name: Install Helm
uses: azure/setup-helm@v4.0.0
uses: azure/setup-helm@v4.1.0
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
git config user.email "[email protected]"

- name: Install Helm
uses: azure/setup-helm@v4.0.0
uses: azure/setup-helm@v4.1.0
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
git config user.email "[email protected]"

- name: Install Helm
uses: azure/setup-helm@v4.0.0
uses: azure/setup-helm@v4.1.0
env:
GITHUB_TOKEN: ${{ secrets.PAT }}

Expand Down
12 changes: 5 additions & 7 deletions backend/cmd/kubevoyage/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"fmt"
"github.com/B-Urb/KubeVoyage/internal/app"
"github.com/B-Urb/KubeVoyage/internal/handlers"
"github.com/B-Urb/KubeVoyage/internal/util"
"github.com/rs/cors"
"gorm.io/gorm"
"log"
"net/http"
"os"
Expand All @@ -14,10 +14,6 @@ import (
// or "gorm.io/driver/postgres" for PostgreSQL
)

var db *gorm.DB

var frontendPathLocal = "./public" //"../frontend/public"

type loggingResponseWriter struct {
http.ResponseWriter
statusCode int
Expand Down Expand Up @@ -69,15 +65,17 @@ func main() {
log.Fatalf(err.Error())
}

mux := setupServer(handler, app.DB)
mux := setupServer(handler)

log.Println("Starting server on :8080")
log.Fatal(http.ListenAndServe(":8080", mux))
}
func setupServer(handle *handlers.Handler, db *gorm.DB) http.Handler {
func setupServer(handle *handlers.Handler) http.Handler {
mux := http.NewServeMux()

handler := cors.Default().Handler(mux)
frontendPathLocal, _ := util.GetEnvOrDefault("FRONTEND_PATH", "./public")
log.Printf("Serving frontend from %s", frontendPathLocal)

// Serve static files
fs := http.FileServer(http.Dir(frontendPathLocal)) // Adjust the path based on your directory structure
Expand Down
12 changes: 6 additions & 6 deletions backend/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module github.com/B-Urb/KubeVoyage
go 1.21

require (
github.com/golang-jwt/jwt/v5 v5.2.0
github.com/golang-jwt/jwt/v5 v5.2.1
github.com/rs/cors v1.10.1
github.com/stretchr/testify v1.8.4
golang.org/x/crypto v0.20.0
gorm.io/driver/mysql v1.5.4
gorm.io/driver/postgres v1.5.6
github.com/stretchr/testify v1.9.0
golang.org/x/crypto v0.21.0
gorm.io/driver/mysql v1.5.6
gorm.io/driver/postgres v1.5.7
gorm.io/driver/sqlite v1.5.5
gorm.io/gorm v1.25.7
gorm.io/gorm v1.25.9
)

require (
Expand Down
16 changes: 16 additions & 0 deletions backend/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJ
github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.2.0 h1:d/ix8ftRUorsN+5eMIlF4T6J8CAt9rch3My2winC1Jw=
github.com/golang-jwt/jwt/v5 v5.2.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk=
github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk=
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=
Expand Down Expand Up @@ -39,12 +41,16 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.20.0 h1:jmAMJJZXr5KiCw05dfYK9QnqaqKLYXijU23lsEdcQqg=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
Expand All @@ -59,10 +65,16 @@ gorm.io/driver/mysql v1.5.1 h1:WUEH5VF9obL/lTtzjmML/5e6VfFR/788coz2uaVCAZw=
gorm.io/driver/mysql v1.5.1/go.mod h1:Jo3Xu7mMhCyj8dlrb3WoCaRd1FhsVh+yMXb1jUInf5o=
gorm.io/driver/mysql v1.5.4 h1:igQmHfKcbaTVyAIHNhhB888vvxh8EdQ2uSUT0LPcBso=
gorm.io/driver/mysql v1.5.4/go.mod h1:9rYxJph/u9SWkWc9yY4XJ1F/+xO0S/ChOmbk3+Z5Tvs=
gorm.io/driver/mysql v1.5.5 h1:WxklwX6FozMs1gk9yVadxGfjGiJjrBKPvIIvYZOMyws=
gorm.io/driver/mysql v1.5.5/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
gorm.io/driver/mysql v1.5.6 h1:Ld4mkIickM+EliaQZQx3uOJDJHtrd70MxAUqWqlx3Y8=
gorm.io/driver/mysql v1.5.6/go.mod h1:sEtPWMiqiN1N1cMXoXmBbd8C6/l+TESwriotuRRpkDM=
gorm.io/driver/postgres v1.5.2 h1:ytTDxxEv+MplXOfFe3Lzm7SjG09fcdb3Z/c056DTBx0=
gorm.io/driver/postgres v1.5.2/go.mod h1:fmpX0m2I1PKuR7mKZiEluwrP3hbs+ps7JIGMUBpCgl8=
gorm.io/driver/postgres v1.5.6 h1:ydr9xEd5YAM0vxVDY0X139dyzNz10spDiDlC7+ibLeU=
gorm.io/driver/postgres v1.5.6/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA=
gorm.io/driver/postgres v1.5.7 h1:8ptbNJTDbEmhdr62uReG5BGkdQyeasu/FZHxI0IMGnM=
gorm.io/driver/postgres v1.5.7/go.mod h1:3e019WlBaYI5o5LIdNV+LyxCMNtLOQETBXL2h4chKpA=
gorm.io/driver/sqlite v1.5.3 h1:7/0dUgX28KAcopdfbRWWl68Rflh6osa4rDh+m51KL2g=
gorm.io/driver/sqlite v1.5.3/go.mod h1:qxAuCol+2r6PannQDpOP1FP6ag3mKi4esLnB/jHed+4=
gorm.io/driver/sqlite v1.5.5 h1:7MDMtUZhV065SilG62E0MquljeArQZNfJnjd9i9gx3E=
Expand All @@ -73,3 +85,7 @@ gorm.io/gorm v1.25.4/go.mod h1:L4uxeKpfBml98NYqVqwAdmV1a2nBtAec/cf3fpucW/k=
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.7 h1:VsD6acwRjz2zFxGO50gPO6AkNs7KKnvfzUjHQhZDz/A=
gorm.io/gorm v1.25.7/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.8 h1:WAGEZ/aEcznN4D03laj8DKnehe1e9gYQAjW8xyPRdeo=
gorm.io/gorm v1.25.8/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
gorm.io/gorm v1.25.9 h1:wct0gxZIELDk8+ZqF/MVnHLkA1rvYlBWUMv2EdsK1g8=
gorm.io/gorm v1.25.9/go.mod h1:hbnx/Oo0ChWMn1BIhpy1oYozzpM15i4YPuHDmfYtwg8=
8 changes: 4 additions & 4 deletions backend/internal/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,22 @@ func InitializeDatabase() (*gorm.DB, error) {

if dbType == "mysql" {
dsn = fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", dbUser, dbPassword, dbHost, dbPort, dbName)
db, err = gorm.Open(mysql.Open(dsn), &gorm.Config{})
db, _ = gorm.Open(mysql.Open(dsn), &gorm.Config{})
} else {
dsn = fmt.Sprintf("host=%s port=%s user=%s dbname=%s password=%s sslmode=disable", dbHost, dbPort, dbUser, dbName, dbPassword)
db, err = gorm.Open(postgres.Open(dsn), &gorm.Config{})
db, _ = gorm.Open(postgres.Open(dsn), &gorm.Config{})
}

case "sqlite":
dsn = dbName // For SQLite, dbName would be the path to the .db file
db, err = gorm.Open(sqlite.Open(dsn), &gorm.Config{})

default:
return nil, fmt.Errorf("Unsupported DB_TYPE: %s", dbType)
return nil, fmt.Errorf("unsupported DB_TYPE: %s", dbType)
}

if err != nil {
return nil, fmt.Errorf("Failed to connect to database: %v", err)
return nil, fmt.Errorf("failed to connect to database: %v", err)
}

return db, nil
Expand Down
Loading
Loading