From 1d5a376bb856969e749ae79cee8a4968090b677a Mon Sep 17 00:00:00 2001 From: gemelovg Date: Wed, 24 Jun 2026 19:34:23 -0600 Subject: [PATCH 01/42] update --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c2bec0368b7..9d2b9c1def4 100644 --- a/README.md +++ b/README.md @@ -21,3 +21,4 @@ go build -o notely && ./notely *This starts the server in non-database mode.* It will serve a simple webpage at `http://localhost:8080`. You do *not* need to set up a database or any interactivity on the webpage yet. Instructions for that will come later in the course! +MYNAME's version of Boot.dev's Notely app. From e2b2bb7bd55b2d848ef154ee78ba54f622679b07 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Wed, 24 Jun 2026 19:47:43 -0600 Subject: [PATCH 02/42] added new worflow --- .github/workflows/ci.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..a2cf2a837ae --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: ci + +on: + pull_request: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: Force Failure + run: (exit 1) From 412e5828ef0fbe98e99b23a496383cdeefb51dfb Mon Sep 17 00:00:00 2001 From: gemelovg Date: Thu, 25 Jun 2026 16:10:01 -0600 Subject: [PATCH 03/42] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2cf2a837ae..6d1b2483779 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Force Failure - run: (exit 1) + run: go version From 68803db9cce8bc406b2a6ed9d85634c71420334e Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sat, 27 Jun 2026 14:26:00 -0600 Subject: [PATCH 04/42] new tests --- .github/workflows/ci.yml | 2 +- internal/auth/get_api_key_test.go | 114 ++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 internal/auth/get_api_key_test.go diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6d1b2483779..e12823b62b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Force Failure - run: go version + run: go test ./... diff --git a/internal/auth/get_api_key_test.go b/internal/auth/get_api_key_test.go new file mode 100644 index 00000000000..63decbb0390 --- /dev/null +++ b/internal/auth/get_api_key_test.go @@ -0,0 +1,114 @@ +package auth + +import ( + "net/http" + "testing" +) + +// func TestGetAPIKey(t *testing.T) { + t.Run("returns error when no authorization header", func(t *testing.T) { + headers := http.Header{} + + key, err := GetAPIKey(headers) + + if err != ErrNoAuthHeaderIncluded { + t.Errorf("expected ErrNoAuthHeaderIncluded, got %v", err) + } + if key != "" { + t.Errorf("expected empty key, got %q", key) + } + }) + + t.Run("returns error for empty authorization header", func(t *testing.T) { + headers := http.Header{ + "Authorization": []string{""}, + } + + key, err := GetAPIKey(headers) + + if err == nil { + t.Fatal("expected error for empty header, got nil") + } + if key != "" { + t.Errorf("expected empty key, got %q", key) + } + }) + + t.Run("returns error for header without 'ApiKey' scheme", func(t *testing.T) { + headers := http.Header{ + "Authorization": []string{"Bearer token123"}, + } + + key, err := GetAPIKey(headers) + + if err == nil { + t.Fatal("expected error for Bearer scheme, got nil") + } + if key != "" { + t.Errorf("expected empty key, got %q", key) + } + }) + + t.Run("returns error for malformed header with only one part", func(t *testing.T) { + headers := http.Header{ + "Authorization": []string{"ApiKey"}, + } + + key, err := GetAPIKey(headers) + + if err == nil { + t.Fatal("expected error for missing key portion, got nil") + } + if key != "" { + t.Errorf("expected empty key, got %q", key) + } + }) + + t.Run("successfully extracts API key from valid header", func(t *testing.T) { + expectedKey := "my-secret-api-key-12345" + headers := http.Header{ + "Authorization": []string{"ApiKey " + expectedKey}, + } + + key, err := GetAPIKey(headers) + + if err != nil { + t.Fatalf("unexpected error: %v", err) + } + if key != expectedKey { + t.Errorf("expected %q, got %q", expectedKey, key) + } + }) + + t.Run("extra whitespace causes issues with Split - known limitation", func(t *testing.T) { + headers := http.Header{ + "Authorization": []string{"ApiKey api-key"}, // Two spaces + } + + key, err := GetAPIKey(headers) + + // Current Split behavior: ["ApiKey", "", "api-key"], so splitAuth[1] = "" + if err == nil && key == "" { + // Documented quirk - production code needs fixing for robust parsing + return + } + if err != nil { + t.Errorf("got error %v, expected none or empty key", err) + } + }) + + t.Run("header case-sensitivity check - lowercase apischeme fails", func(t *testing.T) { + headers := http.Header{ + "Authorization": []string{"apikey secret123"}, + } + + key, err := GetAPIKey(headers) + + if err == nil { + t.Fatal("expected error for lowercase 'apikey', got nil") + } + if key != "" { + t.Errorf("expected empty key, got %q", key) + } + }) +} From c88a99c84af3c120ae6d70b204b01f623286e142 Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sat, 27 Jun 2026 14:27:08 -0600 Subject: [PATCH 05/42] fixed issue --- internal/auth/get_api_key_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/auth/get_api_key_test.go b/internal/auth/get_api_key_test.go index 63decbb0390..62da02dce62 100644 --- a/internal/auth/get_api_key_test.go +++ b/internal/auth/get_api_key_test.go @@ -5,7 +5,7 @@ import ( "testing" ) -// func TestGetAPIKey(t *testing.T) { +func TestGetAPIKey(t *testing.T) { t.Run("returns error when no authorization header", func(t *testing.T) { headers := http.Header{} From d1d176a843c2cba1084d77c5497cdd695a73812e Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sat, 27 Jun 2026 14:30:58 -0600 Subject: [PATCH 06/42] cover flag added --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e12823b62b8..64e6097bf10 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Force Failure - run: go test ./... + run: go test -cover ./... From 604859971445a78e44cb8c746edba56d1c97ed18 Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sat, 27 Jun 2026 14:37:56 -0600 Subject: [PATCH 07/42] added badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9d2b9c1def4..a0b33ced6bb 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +![alt text goes here](https://github.com/Gemelovg/learn-cicd-starter/actions/workflows/ci.yml/badge.svg) # learn-cicd-starter (Notely) This repo contains the starter code for the "Notely" application for the "Learn CICD" course on [Boot.dev](https://boot.dev). From 191058c8ac5090a529b7487764bf38f8af869ab6 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 09:38:09 -0600 Subject: [PATCH 08/42] Add style workflow file --- .github/workflows/style.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/style.yml diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml new file mode 100644 index 00000000000..0847b245e52 --- /dev/null +++ b/.github/workflows/style.yml @@ -0,0 +1,22 @@ +name: style + +on: + pull_request: + branches: [main] + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v6 + + - name: Set up Go + uses: actions/setup-go@v6 + with: + go-version: "1.26.0" + + - name: check style + run: test -z $(go fmt ./...) From 636b27fd77565af856c839429ca70c3f846fe24b Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 09:41:39 -0600 Subject: [PATCH 09/42] updated ci.yml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 64e6097bf10..eabdc3b2227 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,3 +20,6 @@ jobs: - name: Force Failure run: go test -cover ./... + + - name: check style + run: test -z $(go fmt ./...) From af4d616afa6247fcdf37a9a4b68bdbc8902b31a2 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 09:43:56 -0600 Subject: [PATCH 10/42] Update handler_user.go --- handler_user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler_user.go b/handler_user.go index d53d4316fbf..61816fbb0ee 100644 --- a/handler_user.go +++ b/handler_user.go @@ -12,7 +12,7 @@ import ( "github.com/google/uuid" ) -func (cfg *apiConfig) handlerUsersCreate(w http.ResponseWriter, r *http.Request) { +func (cfg *apiConfig) handlerUsersCreate(w http.ResponseWriter, r *http.Request){ type parameters struct { Name string `json:"name"` } From 09788452c48c1984c69837fa4d726f878f818784 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 09:46:54 -0600 Subject: [PATCH 11/42] changed name of job --- .github/workflows/ci.yml | 2 +- .github/workflows/style.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eabdc3b2227..b282c0cb64c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,5 +21,5 @@ jobs: - name: Force Failure run: go test -cover ./... - - name: check style + - name: Style run: test -z $(go fmt ./...) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 0847b245e52..4498f195210 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -18,5 +18,5 @@ jobs: with: go-version: "1.26.0" - - name: check style + - name: Style run: test -z $(go fmt ./...) From 82476458154368fd6f53d09b8a37b09b04c3fa3d Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 09:51:23 -0600 Subject: [PATCH 12/42] change identation --- main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.go b/main.go index 19d7366c5f7..e2179784607 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,7 @@ import ( _ "github.com/tursodatabase/libsql-client-go/libsql" ) -type apiConfig struct { +type apiConfig struct{ DB *database.Queries } From 5182fc73d60a836ec615c3d19a0e9c7372e801c0 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 09:54:16 -0600 Subject: [PATCH 13/42] change identation --- handler_user.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler_user.go b/handler_user.go index 61816fbb0ee..d53d4316fbf 100644 --- a/handler_user.go +++ b/handler_user.go @@ -12,7 +12,7 @@ import ( "github.com/google/uuid" ) -func (cfg *apiConfig) handlerUsersCreate(w http.ResponseWriter, r *http.Request){ +func (cfg *apiConfig) handlerUsersCreate(w http.ResponseWriter, r *http.Request) { type parameters struct { Name string `json:"name"` } From 0d339b4ec9d932d57e904bf423eeec5bee27b38d Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 10:28:54 -0600 Subject: [PATCH 14/42] update --- .github/workflows/style.yml | 2 +- handler_notes.go | 2 +- main.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 4498f195210..25213832903 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Style - run: test -z $(go fmt ./...) + run: test -z $(go fmt ./...) echo $? diff --git a/handler_notes.go b/handler_notes.go index 85a8e3415d9..adf8222a473 100644 --- a/handler_notes.go +++ b/handler_notes.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" ) -func (cfg *apiConfig) handlerNotesGet(w http.ResponseWriter, r *http.Request, user database.User) { +func (cfg *apiConfig) handlerNotesGet(w http.ResponseWriter, r *http.Request, user database.User){ posts, err := cfg.DB.GetNotesForUser(r.Context(), user.ID) if err != nil { respondWithError(w, http.StatusInternalServerError, "Couldn't get posts for user", err) diff --git a/main.go b/main.go index e2179784607..19d7366c5f7 100644 --- a/main.go +++ b/main.go @@ -17,7 +17,7 @@ import ( _ "github.com/tursodatabase/libsql-client-go/libsql" ) -type apiConfig struct{ +type apiConfig struct { DB *database.Queries } From 27a2978f0e9ebde02d79dcdd1c663078733e74e7 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 10:30:53 -0600 Subject: [PATCH 15/42] updted syle.yml --- .github/workflows/style.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 25213832903..4498f195210 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -19,4 +19,4 @@ jobs: go-version: "1.26.0" - name: Style - run: test -z $(go fmt ./...) echo $? + run: test -z $(go fmt ./...) From 29a56b6434bc2b61716a142ee23a370c0e43b5e6 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 10:36:03 -0600 Subject: [PATCH 16/42] update stirngs --- handler_notes.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/handler_notes.go b/handler_notes.go index adf8222a473..85a8e3415d9 100644 --- a/handler_notes.go +++ b/handler_notes.go @@ -9,7 +9,7 @@ import ( "github.com/google/uuid" ) -func (cfg *apiConfig) handlerNotesGet(w http.ResponseWriter, r *http.Request, user database.User){ +func (cfg *apiConfig) handlerNotesGet(w http.ResponseWriter, r *http.Request, user database.User) { posts, err := cfg.DB.GetNotesForUser(r.Context(), user.ID) if err != nil { respondWithError(w, http.StatusInternalServerError, "Couldn't get posts for user", err) From 5128ba1d53aeb4ed8a175c5334cd2df472c11865 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 10:37:47 -0600 Subject: [PATCH 17/42] updated file name --- .github/workflows/style.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/style.yml b/.github/workflows/style.yml index 4498f195210..69e4e86b8ae 100644 --- a/.github/workflows/style.yml +++ b/.github/workflows/style.yml @@ -1,4 +1,4 @@ -name: style +name: Style on: pull_request: From ac4bfbe536e5a327c00ab3f0e8d8d31d70a28055 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 28 Jun 2026 10:41:12 -0600 Subject: [PATCH 18/42] added job --- .github/workflows/ci.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b282c0cb64c..3df045927d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,3 +23,18 @@ jobs: - name: Style run: test -z $(go fmt ./...) + + style: + name: Style + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 'stable' + + - name: Check formatting + run: test -z "$(go fmt ./...)" \ No newline at end of file From ed2e9f7cc3ed91c4e2b2e8049188fa0c3007cfcf Mon Sep 17 00:00:00 2001 From: gemelovg Date: Mon, 29 Jun 2026 19:49:20 -0600 Subject: [PATCH 19/42] added staticcheck --- .github/workflows/ci.yml | 32 +++++++++++++++++++------------- main.go | 5 +++++ 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3df045927d8..ea410771ba6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,16 +25,22 @@ jobs: run: test -z $(go fmt ./...) style: - name: Style - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: 'stable' - - - name: Check formatting - run: test -z "$(go fmt ./...)" \ No newline at end of file + name: Style + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "stable" + + - name: Check formatting + run: test -z "$(go fmt ./...)" + + - name: Install staticcheck + run: go install honnef.co/go/tools/cmd/staticcheck@latest + + - name: Run staticcheck + run: staticcheck ./... diff --git a/main.go b/main.go index 19d7366c5f7..a621713c2bd 100644 --- a/main.go +++ b/main.go @@ -96,3 +96,8 @@ func main() { log.Printf("Serving on port: %s\n", port) log.Fatal(srv.ListenAndServe()) } + +func unused() { + // this function does nothing + // and is called nowhere +} From ccd7c17dab6174c321cc7972b26bb0653c4bc58b Mon Sep 17 00:00:00 2001 From: gemelovg Date: Mon, 29 Jun 2026 19:52:04 -0600 Subject: [PATCH 20/42] updated unused function --- main.go | 5 ----- 1 file changed, 5 deletions(-) diff --git a/main.go b/main.go index a621713c2bd..19d7366c5f7 100644 --- a/main.go +++ b/main.go @@ -96,8 +96,3 @@ func main() { log.Printf("Serving on port: %s\n", port) log.Fatal(srv.ListenAndServe()) } - -func unused() { - // this function does nothing - // and is called nowhere -} From ecabd6de1af8b4975827f24362502906e155ae60 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Wed, 1 Jul 2026 17:10:07 -0600 Subject: [PATCH 21/42] updated ci.yml --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea410771ba6..ef034a9c05e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,6 +24,12 @@ jobs: - name: Style run: test -z $(go fmt ./...) + - name: Install gosec + run: go install github.com/securego/gosec/v2/cmd/gosec@latest + + - name: Run gosec + run: gosec ./... + style: name: Style runs-on: ubuntu-latest From c1fde9bb0dd3c23dc0c46ee648fd375f152a870a Mon Sep 17 00:00:00 2001 From: gemelovg Date: Wed, 1 Jul 2026 17:17:58 -0600 Subject: [PATCH 22/42] updated methods --- json.go | 6 +++++- main.go | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/json.go b/json.go index 1e6e7985e18..9b1f5bf4ec9 100644 --- a/json.go +++ b/json.go @@ -30,5 +30,9 @@ func respondWithJSON(w http.ResponseWriter, code int, payload interface{}) { return } w.WriteHeader(code) - w.Write(dat) + + _, err = w.Write(dat) + if err != nil { + log.Printf("warning: failed to write response: %v", err) + } } diff --git a/main.go b/main.go index 19d7366c5f7..33c296e9683 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "log" "net/http" "os" + "time" "github.com/go-chi/chi" "github.com/go-chi/cors" @@ -89,10 +90,14 @@ func main() { router.Mount("/v1", v1Router) srv := &http.Server{ - Addr: ":" + port, - Handler: router, + Addr: ":" + port, + Handler: router, + ReadHeaderTimeout: 5 * time.Second, // Prevents Slowloris attacks + ReadTimeout: 10 * time.Second, // Prevents slow readers + WriteTimeout: 30 * time.Second, // Limits write duration + IdleTimeout: 60 * time.Second, // Closes idle connections } - log.Printf("Serving on port: %s\n", port) + log.Printf("Serving on port: %s\n", sanitizeLogString(port)) log.Fatal(srv.ListenAndServe()) } From e34d15e79a8b82366a6c42f080ed89965192f95f Mon Sep 17 00:00:00 2001 From: gemelovg Date: Wed, 1 Jul 2026 17:25:37 -0600 Subject: [PATCH 23/42] adde func --- main.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/main.go b/main.go index 33c296e9683..05306e1dbe8 100644 --- a/main.go +++ b/main.go @@ -7,6 +7,7 @@ import ( "log" "net/http" "os" + "strings" "time" "github.com/go-chi/chi" @@ -25,6 +26,18 @@ type apiConfig struct { //go:embed static/* var staticFiles embed.FS +func sanitizeLogString(input string) string { + s := strings.ReplaceAll(input, "\r", "\\r") + s = strings.ReplaceAll(s, "\n", "\\n") + result := "" + for _, ch := range s { + if ch >= 32 || ch == '\t' { + result += string(ch) + } + } + return result +} + func main() { err := godotenv.Load(".env") if err != nil { From 961465f9337b02f383278ba1243a22f70576563d Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 5 Jul 2026 18:34:04 -0600 Subject: [PATCH 24/42] new workflow --- .github/workflows/cd.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/cd.yml diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 00000000000..f611c16123e --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,20 @@ +name: cd + +on: + push: + branches: [main] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: "go.mod" + + - name: Build application + run: bash scripts/buildprod.sh From 3bb9990ff5179d388287995b84064a6881ecb1f6 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Sun, 5 Jul 2026 18:37:20 -0600 Subject: [PATCH 25/42] updated wf --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f611c16123e..6cf52a7472f 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -5,7 +5,7 @@ on: branches: [main] jobs: - deploy: + Deploy: runs-on: ubuntu-latest steps: - name: Checkout code From 07b304c14fe0f0a43dde2984d13902b746df83e4 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Mon, 6 Jul 2026 19:23:02 -0600 Subject: [PATCH 26/42] updated ci.yml --- .github/workflows/cd.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 6cf52a7472f..c6cfe7f8db5 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -18,3 +18,15 @@ jobs: - name: Build application run: bash scripts/buildprod.sh + + - id: "auth" + uses: "google-github-actions/auth@v2" + with: + credentials_json: "${{ secrets.GCP_CREDENTIALS }}" + + - name: "Set up Cloud SDK" + uses: "google-github-actions/setup-gcloud@v3" + + - name: Build and Push Docker Image + run: | + gcloud builds submit --tag us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest . From 88aa36d23c2267a7abeb9c00ad73f9fa5f9f4030 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Mon, 6 Jul 2026 19:25:49 -0600 Subject: [PATCH 27/42] update --- sql/queries/notes.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/queries/notes.sql b/sql/queries/notes.sql index 72b50bcda77..92f190359fb 100644 --- a/sql/queries/notes.sql +++ b/sql/queries/notes.sql @@ -10,3 +10,4 @@ SELECT * FROM notes WHERE id = ?; -- name: GetNotesForUser :many SELECT * FROM notes WHERE user_id = ?; -- +-- From b01d6267adbe0db03ce0e7a2b9146f8f9833d55b Mon Sep 17 00:00:00 2001 From: gemelovg Date: Mon, 6 Jul 2026 19:30:13 -0600 Subject: [PATCH 28/42] update2 --- sql/queries/notes.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/sql/queries/notes.sql b/sql/queries/notes.sql index 92f190359fb..38125c030ad 100644 --- a/sql/queries/notes.sql +++ b/sql/queries/notes.sql @@ -11,3 +11,4 @@ SELECT * FROM notes WHERE id = ?; SELECT * FROM notes WHERE user_id = ?; -- -- +__ From b09e237736f0311505edec44c0a93eac241e425e Mon Sep 17 00:00:00 2001 From: gemelovg Date: Wed, 8 Jul 2026 18:33:27 -0600 Subject: [PATCH 29/42] updated stuff --- .github/workflows/cd.yml | 3 + static/index.html | 385 +++++++++++++++++++++------------------ 2 files changed, 208 insertions(+), 180 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index c6cfe7f8db5..a8439374f50 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -30,3 +30,6 @@ jobs: - name: Build and Push Docker Image run: | gcloud builds submit --tag us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest . + + - name: Deploy to Cloud Run + run: gcloud run deploy notely --image us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-00001-6nf --max-instances=4 diff --git a/static/index.html b/static/index.html index 72be101028c..e59125d6950 100644 --- a/static/index.html +++ b/static/index.html @@ -1,193 +1,218 @@ - + + + + Notely + + + +

Welcome to Notely

+ +
+ + +
+ + + + - async function createNote() { - if (!currentUser) { - alert('Please create a user first'); - return; + - - + body { + font-family: + system-ui, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + Roboto, + Oxygen, + Ubuntu, + Cantarell, + "Open Sans", + "Helvetica Neue", + sans-serif; + background-color: var(--dark); + color: var(--light); + margin: 0; + padding: 0; + height: 100vh; + } + + .section { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + } + + textarea { + width: 300px; + height: 100px; + margin-bottom: 10px; + } + + input { + display: block; + padding: 1rem; + } + + button { + background-color: var(--primary); + color: var(--light); + border: none; + padding: 15px 32px; + text-align: center; + text-decoration: none; + display: inline-block; + font-size: 16px; + margin: 4px 2px; + cursor: pointer; + transition-duration: 0.4s; + } + + button:hover { + background-color: var(--primary-light); + } + + .note { + width: 300px; + background-color: var(--grey); + border: 1px solid var(--primary); + padding: 10px; + margin-bottom: 10px; + } + + + From e098cce31a4b0225dfce332d6c0a7f294e8d9db2 Mon Sep 17 00:00:00 2001 From: gemelovg Date: Wed, 8 Jul 2026 18:37:20 -0600 Subject: [PATCH 30/42] updated ci --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index a8439374f50..15d8bdfc222 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -32,4 +32,4 @@ jobs: gcloud builds submit --tag us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest . - name: Deploy to Cloud Run - run: gcloud run deploy notely --image us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely-00001-6nf --max-instances=4 + run: gcloud run deploy notely --image us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely --max-instances=4 From 7b64d1ad749236efac4c5a6947265dfc3f28afaa Mon Sep 17 00:00:00 2001 From: gemelovg Date: Wed, 8 Jul 2026 18:42:44 -0600 Subject: [PATCH 31/42] updated cd --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 15d8bdfc222..0cb88207624 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -32,4 +32,4 @@ jobs: gcloud builds submit --tag us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest . - name: Deploy to Cloud Run - run: gcloud run deploy notely --image us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project notely --max-instances=4 + run: gcloud run deploy notely --image us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project crypto-symbol-440301-a6 --max-instances=4 From f5498e1178edbe3919c6749e7aff04ff4d9632ce Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:09:24 -0600 Subject: [PATCH 32/42] updated ci.yml --- .github/workflows/cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 0cb88207624..f35cd35a538 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -29,7 +29,7 @@ jobs: - name: Build and Push Docker Image run: | - gcloud builds submit --tag us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest . + gcloud builds submit --tag us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest . - name: Deploy to Cloud Run - run: gcloud run deploy notely --image us-central1-docker.pkg.dev/crypto-symbol-440301-a6/notely-ar-repo/notely:latest --region us-central1 --allow-unauthenticated --project crypto-symbol-440301-a6 --max-instances=4 + run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest --region us-central1 --allow-unauthenticated --project notely-502219 --max-instances=4 From b6af2581b0fba19ab681266d15425fb813c5140d Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:19:19 -0600 Subject: [PATCH 33/42] udpated ci.yml --- .github/workflows/cd.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index f35cd35a538..dcedd21d9d4 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -30,6 +30,15 @@ jobs: - name: Build and Push Docker Image run: | gcloud builds submit --tag us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest . + + - name: run migrations + run: bash scripts/migrateup.sh + - name: Deploy to Cloud Run run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest --region us-central1 --allow-unauthenticated --project notely-502219 --max-instances=4 + + + # This part + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} From 463fa8a073dc2938392603fd0ef6a647b5e92478 Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:20:40 -0600 Subject: [PATCH 34/42] com,mit --- .github/workflows/cd.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index dcedd21d9d4..e7a56109057 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,6 +11,9 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} + - name: Set up Go uses: actions/setup-go@v5 with: @@ -30,15 +33,11 @@ jobs: - name: Build and Push Docker Image run: | gcloud builds submit --tag us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest . - + - name: run migrations run: bash scripts/migrateup.sh - - name: Deploy to Cloud Run run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest --region us-central1 --allow-unauthenticated --project notely-502219 --max-instances=4 - # This part - env: - DATABASE_URL: ${{ secrets.DATABASE_URL }} From 896c2156d17400b582c2542ada5ca2a5e92fa835 Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:21:58 -0600 Subject: [PATCH 35/42] move env --- .github/workflows/cd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e7a56109057..8682ce59e10 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -11,8 +11,8 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - env: - DATABASE_URL: ${{ secrets.DATABASE_URL }} + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} - name: Set up Go uses: actions/setup-go@v5 From 0e9fefe648021d4b25005963876a908e5bcba5ce Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:26:12 -0600 Subject: [PATCH 36/42] update ci.yml --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef034a9c05e..40b7cfde233 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,9 @@ jobs: with: go-version: "1.26.0" + - name: install goose + run: go install github.com/pressly/goose/v3/cmd/goose@latest + - name: Force Failure run: go test -cover ./... From 03493aa539c29cc8de63bf651e77fff8af698829 Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:28:22 -0600 Subject: [PATCH 37/42] updated cdyml install goose --- .github/workflows/cd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8682ce59e10..d4f58f20556 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -19,6 +19,9 @@ jobs: with: go-version-file: "go.mod" + - name: install goose + run: go install github.com/install goosepressly/goose/v3/cmd/goose@latest + - name: Build application run: bash scripts/buildprod.sh From ba433c56faea8c41cf2bbc4efd1553228c74711e Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:29:49 -0600 Subject: [PATCH 38/42] updated cd --- .github/workflows/cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d4f58f20556..03a1e2d715d 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -15,7 +15,7 @@ jobs: DATABASE_URL: ${{ secrets.DATABASE_URL }} - name: Set up Go - uses: actions/setup-go@v5 + uses: actions/setup-go@v3 with: go-version-file: "go.mod" From ba35c76bd67e9744586259e9d9b1eb199b158a5c Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:34:19 -0600 Subject: [PATCH 39/42] uopdatec ccd --- .github/workflows/cd.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 03a1e2d715d..dd2a8b299c3 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -19,8 +19,8 @@ jobs: with: go-version-file: "go.mod" - - name: install goose - run: go install github.com/install goosepressly/goose/v3/cmd/goose@latest + - name: Install goose + run: go install github.com/pressly/goose/v3/cmd/goose@latest - name: Build application run: bash scripts/buildprod.sh @@ -42,5 +42,3 @@ jobs: - name: Deploy to Cloud Run run: gcloud run deploy notely --image us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest --region us-central1 --allow-unauthenticated --project notely-502219 --max-instances=4 - - # This part From c74f418bc2e37da51e4a3b34a3440c20284d7b61 Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Sun, 12 Jul 2026 14:43:34 -0600 Subject: [PATCH 40/42] updated cd --- .github/workflows/cd.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index dd2a8b299c3..809d36daf6e 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -7,12 +7,14 @@ on: jobs: Deploy: runs-on: ubuntu-latest + env: + DATABASE_URL: ${{ secrets.DATABASE_URL }} + steps: - name: Checkout code uses: actions/checkout@v4 - env: - DATABASE_URL: ${{ secrets.DATABASE_URL }} + - name: Set up Go uses: actions/setup-go@v3 From 17ca0bbcbe6fbb75407dd6cc43caa89085d6274a Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Wed, 15 Jul 2026 19:32:22 -0600 Subject: [PATCH 41/42] Update index.html --- static/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/index.html b/static/index.html index e59125d6950..b9e3d77be84 100644 --- a/static/index.html +++ b/static/index.html @@ -2,7 +2,7 @@ - Notely + Notely! From f132bf4a1b402d806c109f541808030bc0d42477 Mon Sep 17 00:00:00 2001 From: Alex Vg Date: Wed, 15 Jul 2026 19:40:30 -0600 Subject: [PATCH 42/42] Update cd.yml --- .github/workflows/cd.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 809d36daf6e..31d300ec13e 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -14,8 +14,6 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - - name: Set up Go uses: actions/setup-go@v3 with: @@ -36,8 +34,7 @@ jobs: uses: "google-github-actions/setup-gcloud@v3" - name: Build and Push Docker Image - run: | - gcloud builds submit --tag us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest . + run: gcloud builds submit --tag us-central1-docker.pkg.dev/notely-502219/notely-ar-repo/notaly:latest . - name: run migrations run: bash scripts/migrateup.sh