Skip to content

Commit 5332ba5

Browse files
committed
feat: Add TIME_ZONE environment variable
1 parent 0e91fc0 commit 5332ba5

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

app.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@
6969
"HM_DOMAIN_NAME": {
7070
"description": "Domain name hosting the website (e.g. apply.example.com)",
7171
"required": true
72+
},
73+
"TIME_ZONE": {
74+
"description": "Time zone (e.g. America/New_York, default is UTC)",
75+
"required": false
7276
}
7377
},
7478
"addons": [

app/views/manage/configs/index.html.haml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@
6868
%hr
6969
= render 'config_row', name: 'Rollbar Access Token', key: 'ROLLBAR_ACCESS_TOKEN', secret: true, required: false
7070
%hr
71+
= render 'config_row', name: 'Time Zone', key: 'TIME_ZONE', default: 'UTC', required: false
72+
%hr
7173
%p.mb-0
7274
%b Email Provider
7375
- if Rails.application.config.action_mailer.delivery_method == :smtp

config/application.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ class Application < Rails::Application
1818
# -- all .rb files in that directory are automatically loaded after loading
1919
# the framework and any gems in your application.
2020

21+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
22+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
23+
config.time_zone = ENV["TIME_ZONE"].presence || "UTC"
24+
2125
config.active_job.queue_adapter = :sidekiq
2226
end
2327
end

docs/deployment-environment-variables.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ AWS_REGION="us-east-1"
2020
ROLLBAR_ACCESS_TOKEN="<server-side rollbar token>"
2121
SPARKPOST_API_KEY="<sparkpost api key>"
2222
SPARKPOST_CAMPAIGN_ID="my-hackathon"
23+
TIME_ZONE="America/New_York"
2324
```
2425

2526
_Also see [app.json](https://github.com/codeRIT/hackathon_manager/blob/master/app.json)_
@@ -113,6 +114,18 @@ MLH_KEY=""
113114
MLH_SECRET=""
114115
```
115116

117+
### Time Zone
118+
119+
By default, charts & timestamps will be in UTC.
120+
121+
>HackathonManager will crash at startup if the time zone isn't valid.
122+
>
123+
>To find your appropriate time zone (e.g. `America/New_York`), see "TZ database name" on [Wikipedia](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)
124+
125+
```bash
126+
TIME_ZONE="America/Los_Angeles"
127+
```
128+
116129
### Skylight
117130

118131
Skylight provides detailed performance analytics for the app, if you chose to use it.

0 commit comments

Comments
 (0)