Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
christoandrew committed Jul 9, 2024
0 parents commit 5361709
Show file tree
Hide file tree
Showing 60 changed files with 5,883 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MYSQL_DATABASE_HOST=localhost
MYSQL_DATABASE_PORT=3306
MYSQL_DATABASE_NAME=haven
MYSQL_USERNAME=root
MYSQL_PASSWORD=
HOST=127.0.0.1
PORT=8080
21 changes: 21 additions & 0 deletions .github/workflows/qodana_code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- main

jobs:
qodana:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Qodana Scan'
uses: JetBrains/[email protected]
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
with:
args: --baseline,qodana.sarif.json
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
.DS_Store
.idea/
.vscode/
qodana.sarif.json
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
golang 1.21.5
40 changes: 40 additions & 0 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package server

import (
"log"

"github.com/christo-andrew/haven/internal/api"
"github.com/christo-andrew/haven/internal/models"
"github.com/christo-andrew/haven/pkg/config"
database "github.com/christo-andrew/haven/pkg/database"
"github.com/joho/godotenv"
)

// @title Haven API
// @version 1.0

// @contact.name API Support
// @contact.url http://www.swagger.io/support
// @contact.email [email protected]

// @license.name Apache 2.0
// @license.url http://www.apache.org/licenses/LICENSE-2.0.html

// @host localhost:8080
// @BasePath /api/v1

func StartApp() {
serverConfig := config.DefaultServerConfig()
err := godotenv.Load(serverConfig.EnvPath)
if err != nil {
log.Fatal(err)
}
db := database.GetDB(serverConfig.DatabaseConfig)
app := api.NewServer(serverConfig)
server := app.SetupRouter(db)
models.Migrate(db)
err = server.Run()
if err != nil {
panic(err)
}
}
Loading

0 comments on commit 5361709

Please sign in to comment.