-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into dependabot/pip/mock_data/pip-aed9f6bbcd
- Loading branch information
Showing
187 changed files
with
13,020 additions
and
13,861 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,3 +24,4 @@ frontend/mobile/android/ | |
tmp/ | ||
ios | ||
android | ||
.idea/modules.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Configuration | ||
|
||
SAC uses environment variables for configuration. SAC will, by default, pull the envvars from the process in which it was launched, but you can also pass in a .env file (using the --config flag) and use the values defined in there. See .env.template for an example .env file. | ||
|
||
| Name | Group | Description | | ||
|--------------------------------------|------------|---------------------------------------| | ||
| SAC_APPLICATION_PORT | app | port to run the server on. | | ||
| SAC_APPLICATION_HOST | app | host to run the server on. | | ||
| SAC_APPLICATION_BASE_URL | app | base url to run the server on. | | ||
| SAC_DB_USERNAME | db | username for database. | | ||
| SAC_DB_PASSWORD | db | password for database. | | ||
| SAC_DB_PORT | db | port for database. | | ||
| SAC_DB_HOST | db | host for database. | | ||
| SAC_DB_NAME | db | name of database. | | ||
| SAC_DB_REQUIRE_SSL | db | if the db connection requires ssl. | | ||
| SAC_REDIS_ACTIVE_TOKENS_USERNAME | redis | username for active tokens redis. | | ||
| SAC_REDIS_ACTIVE_TOKENS_PASSWORD | redis | password for active tokens redis. | | ||
| SAC_REDIS_ACTIVE_TOKENS_HOST | redis | host for active tokens redis. | | ||
| SAC_REDIS_ACTIVE_TOKENS_PORT | redis | port for active tokens redis. | | ||
| SAC_REDIS_ACTIVE_TOKENS_DB | redis | db for active tokens redis. | | ||
| SAC_REDIS_BLACKLIST_USERNAME | redis | username for blacklist redis. | | ||
| SAC_REDIS_BLACKLIST_PASSWORD | redis | password for blacklist redis. | | ||
| SAC_REDIS_BLACKLIST_HOST | redis | host for blacklist redis. | | ||
| SAC_REDIS_BLACKLIST_PORT | redis | port for blacklist redis. | | ||
| SAC_REDIS_BLACKLIST_DB | redis | db for blacklist redis. | | ||
| SAC_REDIS_LIMITER_USERNAME | redis | username for limiter redis. | | ||
| SAC_REDIS_LIMITER_PASSWORD | redis | password for limiter redis. | | ||
| SAC_REDIS_LIMITER_HOST | redis | host for limiter redis. | | ||
| SAC_REDIS_LIMITER_PORT | redis | port for limiter redis. | | ||
| SAC_REDIS_LIMITER_DB | redis | db for limiter redis. | | ||
| SAC_SUDO_PASSWORD | superuser | password for the superuser. | | ||
| SAC_AUTH_ACCESS_KEY | auth | access key for auth. | | ||
| SAC_AUTH_REFRESH_KEY | auth | refresh key for auth. | | ||
| SAC_AWS_BUCKET_NAME | aws | bucket name for aws s3. | | ||
| SAC_AWS_ID | aws | id for aws s3. | | ||
| SAC_AWS_SECRET | aws | secret for aws s3. | | ||
| SAC_AWS_REGION | aws | region for aws s3. | | ||
| SAC_RESEND_API_KEY | resend | api key for resend. | | ||
| SAC_CALENDAR_MAX_TERMINATION_DATE | calendar | max termination date for calendar integrations. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package auth | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/GenerateNU/sac/backend/utilities" | ||
"github.com/gofiber/fiber/v2" | ||
"github.com/google/uuid" | ||
) | ||
|
||
type localsKey byte | ||
|
||
const ( | ||
claimsKey localsKey = 0 | ||
userIDKey localsKey = 1 | ||
) | ||
|
||
func CustomClaimsFrom(c *fiber.Ctx) (*CustomClaims, error) { | ||
rawClaims := c.Locals(claimsKey) | ||
if rawClaims == nil { | ||
return nil, utilities.Forbidden() | ||
} | ||
|
||
claims, ok := rawClaims.(*CustomClaims) | ||
if !ok { | ||
return nil, fmt.Errorf("claims are not of type CustomClaims. got: %T", rawClaims) | ||
} | ||
|
||
return claims, nil | ||
} | ||
|
||
func SetClaims(c *fiber.Ctx, claims *CustomClaims) { | ||
c.Locals(claimsKey, claims) | ||
} | ||
|
||
func UserIDFrom(c *fiber.Ctx) (*uuid.UUID, error) { | ||
userID := c.Locals(userIDKey) | ||
if userID == nil { | ||
return nil, utilities.Forbidden() | ||
} | ||
|
||
id, ok := userID.(*uuid.UUID) | ||
if !ok { | ||
return nil, fmt.Errorf("userID is not of type uuid.UUID. got: %T", userID) | ||
} | ||
|
||
return id, nil | ||
} | ||
|
||
func SetUserID(c *fiber.Ctx, id *uuid.UUID) { | ||
c.Locals(userIDKey, id) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package config | ||
|
||
type ApplicationSettings struct { | ||
Port uint16 `env:"PORT"` | ||
Host string `env:"HOST"` | ||
BaseUrl string `env:"BASE_URL"` | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.