From 28e138d4e1a4546476617c480bfead8163c09913 Mon Sep 17 00:00:00 2001 From: Westainly <65798181+Westainly@users.noreply.github.com> Date: Tue, 11 Jun 2024 19:53:57 -0600 Subject: [PATCH 1/2] Fixing links for example methods due to file structure changes (#24) --- backend/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/README.md b/backend/README.md index 562551f7..c64b27d9 100644 --- a/backend/README.md +++ b/backend/README.md @@ -32,7 +32,7 @@ There are 5 major steps to creating or editing an endpoint. #### **GET and POST Handlers** The following links to the current penalty API handlers. Use this as an example for creating new handlers so everything in the backend follows a similar pattern. -- [Example Penalties API Handler](/backend/internal/server/apis/stats/penalty.go) +- [Example Penalties API Handler](/backend/internal/server/apis/sports/stats/penalty.go) 4. Add in any handlers to the init function ``` go @@ -59,7 +59,7 @@ The following link is to an example .go file containing methods to be used as an 2. Create or update the corresponding .yml file to correctly reflect any changes you have made. 3. Use the following linked .yml file to keep the documentation consistent throughout the backend. -- [Example .yml file](/static/oas/v1/stats/penalties.yml) +- [Example .yml file](/static/oas/v1/sports/stats/penalties.yml) ## Adding and Updating Unit Testing for Database Model Adding a unit test for a database model. These tests will be using a docker spin up of the actual database for testing the database interfacing functions. From 75a13c53f4be7362018c03545667da1f2e5c5110 Mon Sep 17 00:00:00 2001 From: Skyler Cain Date: Thu, 13 Jun 2024 20:27:02 -0600 Subject: [PATCH 2/2] Update README.md and add local.env.example Update README.md and add local.env.example **Why** We want to have a nice example of environment variables that can be used when developing locally. **How** Update README.md to call out the importance of having a local.env as well as add an example env file. --- README.md | 6 ++++++ backend/internal/middleware/manager.go | 2 +- config/local.env.example | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 config/local.env.example diff --git a/README.md b/README.md index dd59c2f7..b6de0df6 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,12 @@ - [Backend](/backend/README.md) ## Helpful Commands + +### Environment Variables +We use dotenv and a local.env to store all environment variables. +Please copy config/local.env.example to config/local.env and update +any environment variables. + ### Clear and Re-run Migrations Sometimes you need to clear out migrations due to a model change. While we are in early development we've decided to drop and recreate diff --git a/backend/internal/middleware/manager.go b/backend/internal/middleware/manager.go index e150e25f..a075febf 100644 --- a/backend/internal/middleware/manager.go +++ b/backend/internal/middleware/manager.go @@ -59,7 +59,7 @@ func Setup(app *fiber.App) { log.Alert("Setting permissive CORS") // CORS https://docs.gofiber.io/api/middleware/cors / app.Use(cors.New(cors.Config{ - AllowOrigins: "*", + AllowOrigins: "http://localhost:9002", AllowCredentials: true, AllowMethods: "POST, GET, OPTIONS, PUT, DELETE", AllowHeaders: "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, Cookie", diff --git a/config/local.env.example b/config/local.env.example new file mode 100644 index 00000000..9a114f64 --- /dev/null +++ b/config/local.env.example @@ -0,0 +1,3 @@ +POWERPLAY_JWT_SECRET=your_secret_here +POWERPLAY_PASSWORD_KEY=your_secret_here +POWERPLAY_PORT=9002