Skip to content
Open
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
2 changes: 1 addition & 1 deletion uptime-backend/src/cmd/uptime_backend/main_bpu.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func main() {
}

app.Now = func() time.Time { return time.Now() }
app.SubmitCounter = NewAttemptCounter(REQUESTS_PER_PK_HOURLY)
app.SubmitCounter = NewAttemptCounter(appCfg.RequestsPerPkHourly)

whitelist := appCfg.Whitelist
app.Whitelist = new(WhitelistMVar)
Expand Down
14 changes: 10 additions & 4 deletions uptime-backend/src/uptime_backend/app_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ func LoadEnv(log logging.EventLogger) AppConfig {
loadAwsCredentials(awsCredentialsFile, log)
}

// Set default rate limit if not specified
if config.RequestsPerPkHourly == 0 {
config.RequestsPerPkHourly = 360
}

return config
}

Expand All @@ -90,10 +95,11 @@ type AwsConfig struct {
}

type AppConfig struct {
Aws *AwsConfig `json:"aws"`
GsheetId string `json:"gsheet_id"`
Whitelist []string `json:"whitelist"`
InMemory bool `json:"in_memory"`
Aws *AwsConfig `json:"aws"`
GsheetId string `json:"gsheet_id"`
Whitelist []string `json:"whitelist"`
InMemory bool `json:"in_memory"`
RequestsPerPkHourly int `json:"requests_per_pk_hourly"`
}

type AwsCredentials struct {
Expand Down
1 change: 0 additions & 1 deletion uptime-backend/src/uptime_backend/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
)

const MAX_SUBMIT_PAYLOAD_SIZE = 50000000 // max payload size in bytes
const REQUESTS_PER_PK_HOURLY = 120
const UPTIME_BACKEND_LISTEN_TO = ":8080"
const TIME_DIFF_DELTA time.Duration = -5 * time.Minute // -5m
const WHITELIST_REFRESH_INTERVAL = 10 * time.Minute // 10m
Expand Down
Loading