Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
VOTE_HOST=http://localhost:8080
VOTE_STATE=1000000
VOTE_OIDC_ID=develop
VOTE_JWT_SECRET=ahahaisdfjioThisShouldBeRandom
VOTE_OIDC_SECRET=no peeking (on wiki)
DEV_DISABLE_ACTIVE_FILTERS=true
DEV_FORCE_IS_EVALS=true
VOTE_CONDITIONAL_URL=https://conditional.csh.rit.edu/gatekeep
VOTE_TOKEN=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
VOTE_MONGODB_URI=mongodb://vote:c1f66aac6b4fafbef3c659371b8a50ed@mongodb/vote?authSource=admin
VOTE_ANNOUNCEMENTS_CHANNEL_ID=
VOTE_SLACK_APP_TOKEN=
VOTE_SLACK_BOT_TOKEN=
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.env*
.env
vote
.idea/
.vscode/
.vscode/

18 changes: 1 addition & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,7 @@ Implementation

## Configuration

If you're using the compose file, you'll need to ask an RTP for the vote-dev OIDC secret, and set it as `VOTE_OIDC_SECRET` in your environment

If you're not using the compose file, you'll need more of these

```
VOTE_HOST=http://localhost:8080
VOTE_JWT_SECRET=
VOTE_MONGODB_URI=
VOTE_OIDC_ID=
VOTE_OIDC_SECRET=
VOTE_STATE=
VOTE_TOKEN=
VOTE_CONDITIONAL_URL=https://conditional.csh.rit.edu/gatekeep/
VOTE_ANNOUNCEMENTS_CHANNEL_ID=
VOTE_SLACK_APP_TOKEN=
VOTE_SLACK_BOT_TOKEN=
```
Copy `.env.example` to `.env` and fill out the info

### Dev Overrides
`DEV_DISABLE_ACTIVE_FILTERS="true"` will disable the requirements that you be active to vote
Expand Down
4 changes: 4 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
}

// CreatePoll Submits the specific details of a new poll that a user wants to create to the database
func CreatePoll(c *gin.Context) {

Check failure on line 129 in api.go

View check run for this annotation

CSH-Sonarqube-Community / SonarQube Code Analysis

api.go#L129

Refactor this method to reduce its Cognitive Complexity from 19 to the 15 allowed.
user := GetUserData(c)

// If user is not active, display the unauthorized screen
Expand Down Expand Up @@ -195,6 +195,10 @@
}
poll.AllowedUsers = GetEligibleVoters()
for user := range strings.SplitSeq(c.PostForm("waivedUsers"), ",") {
if len(user) == 0 { // When it's empty (and probably in other cases) the split can return an empty string, which changes the total
continue
}

poll.AllowedUsers = append(poll.AllowedUsers, strings.TrimSpace(user))
}
}
Expand Down
12 changes: 3 additions & 9 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@ services:
container_name: vote
depends_on:
- mongodb
environment:
VOTE_HOST: 'http://localhost:8080'
VOTE_JWT_SECRET: 4874c601dda90a01c7543c571be08680
VOTE_MONGODB_URI: "mongodb://vote:c1f66aac6b4fafbef3c659371b8a50ed@mongodb/vote?authSource=admin"
VOTE_OIDC_ID: vote-dev
VOTE_OIDC_SECRET: "${VOTE_OIDC_SECRET}"
VOTE_STATE: 27a28540e47ec786b7bdad03f83171b3
DEV_DISABLE_ACTIVE_FILTERS: "${DEV_DISABLE_ACTIVE_FILTERS}"
DEV_FORCE_IS_EVALS: "${DEV_FORCE_IS_EVALS}"
env_file:
- path: .env
required: false
ports:
- "127.0.0.1:8080:8080"

Expand Down
Loading