diff --git a/.gitignore b/.gitignore index 79f32e2..0c6ad57 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,6 @@ scc # Log files logs/ + +# DB +*.db diff --git a/config/development.toml b/config/development.toml index c7ab8c8..33b3547 100644 --- a/config/development.toml +++ b/config/development.toml @@ -1,3 +1,7 @@ +[server] +host = "localhost" +port = 3000 + [buzzer] song = [ "-n", "-f880", "-l100", "-d0", diff --git a/internal/cmd/api.go b/internal/cmd/api.go index bf3165d..1e04757 100644 --- a/internal/cmd/api.go +++ b/internal/cmd/api.go @@ -30,7 +30,7 @@ func apiCmd(db *db.DB) { api.New(apiGroup, db) host := config.GetDefaultString("server.host", "127.0.0.1") - port := config.GetDefaultInt("server.port", 8080) + port := config.GetDefaultInt("server.port", 3000) zap.S().Fatal("API: Fatal server error", app.Listen(fmt.Sprintf("%s:%d", host, port))) } diff --git a/internal/pkg/db/db.go b/internal/pkg/db/db.go index 36263b7..6de1d04 100644 --- a/internal/pkg/db/db.go +++ b/internal/pkg/db/db.go @@ -6,7 +6,6 @@ import ( _ "github.com/mattn/go-sqlite3" // SQLite driver "github.com/zeusWPI/scc/internal/pkg/db/sqlc" - "github.com/zeusWPI/scc/pkg/config" ) // DB represents a database connection @@ -17,9 +16,7 @@ type DB struct { // New creates a new database connection func New() (*DB, error) { - dbPath := config.GetDefaultString("db.path", "./sqlite.db") - - db, err := sql.Open("sqlite3", dbPath) + db, err := sql.Open("sqlite3", "./sqlite.db") if err != nil { return nil, err } diff --git a/makefile b/makefile index e870d7c..1f404c9 100644 --- a/makefile +++ b/makefile @@ -18,10 +18,10 @@ create-migration: goose: @read -p "Action: " action; \ - goose -dir ./db/migrations postgres "user=postgres password=postgres dbname=adoca host=localhost sslmode=disable" $$action + goose -dir ./db/migrations sqlite3 ./sqlite.db $$action migrate: - @goose -dir ./db/migrations postgres "user=postgres password=postgres dbname=adoca host=localhost sslmode=disable" up + @goose -dir ./db/migrations sqlite3 ./sqlite.db up watch: @if command -v air > /dev/null; then \