-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathapplication.conf
More file actions
183 lines (155 loc) · 8.02 KB
/
Copy pathapplication.conf
File metadata and controls
183 lines (155 loc) · 8.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# This is the main configuration file for the application.
# Include custom modules that we've defined.
play.application.loader = "CustomApplicationLoader"
play.modules.enabled += "modules.CustomControllerModule"
play.modules.enabled += "modules.ActorModule"
play.modules.enabled += "modules.ExecutorsModule"
# The secret key is used to secure cryptographics functions. Set through an env variable on production servers.
# See http://www.playframework.com/documentation/latest/ApplicationSecret for more details.
play.http.secret.key=${?SIDEWALK_APPLICATION_SECRET}
# HMAC-SHA256 secret for signing time-limited image-serving URLs (/backupImage and /cropImage endpoints).
image.signing.secret=${play.http.secret.key}
# Environment type: local, test, or prod.
environment-type = "local"
environment-type = ${?ENV_TYPE}
# Define available languages. Translations are in conf/messages for back end and in public/locales for front end.
play.i18n.langs = [ "en", "es", "nl", "zh-TW", "de", "pt-BR", "en-US", "en-NZ" ]
play.i18n.defaultLang = "en"
play.i18n.langCookieName = "PROD_PLAY_LANG"
play.i18n.path = "messages" # Location of messages files for internationalization, relative to the conf directory.
# Asset configuration.
play.assets {
path = "/public"
urlPrefix = "/assets"
}
# Prevent timing out on long-running API requests. Fixes https://github.com/ProjectSidewalk/SidewalkWebpage/issues/3544.
play.server.http.idleTimeout = 5 minutes # Default is 75 seconds.
# Allow larger request headers to account for large cookies from numerous cities.
# Fixes https://github.com/ProjectSidewalk/SidewalkWebpage/issues/3381.
play.server.max-header-size = 32k # Default is 8k.
# Default database configuration.
slick.dbs.default.profile="models.utils.MyPostgresProfile$"
slick.dbs.default.db.driver = "org.postgresql.Driver"
slick.dbs.default.db.url="jdbc:postgresql://db:5432/sidewalk"
slick.dbs.default.db.url=${?DATABASE_URL}
slick.dbs.default.db.user="sidewalk"
slick.dbs.default.db.user=${?DATABASE_USER}
slick.dbs.default.db.password="sidewalk"
slick.dbs.default.db.password=${?DATABASE_PASSWORD}
# Evolutions configuration. To apply them globally, use play.evolutions instead of play.evolutions.db.default.
# But we only have one db, so that doesn't matter for our purposes.
# https://www.playframework.com/documentation/3.0.x/Evolutions#Evolutions-configuration
play.evolutions.db.default.enabled=true
play.evolutions.db.default.autocommit=false # Makes each evolution run in a transaction, so all is rolled back on fail.
play.evolutions.db.default.autoApply=true
play.evolutions.db.default.autoApplyDowns=true
play.evolutions.db.default.substitutions.mappings = {
city-id = ${?SIDEWALK_CITY_ID} # Used in evolutions to set the city id for the current city.
}
# Configure thread pools. Slick has it's own, there's the main Play thread pool, and our custom cpu-intensive pool.
# NOTE numThreads must be set to the same number as maxConnections.
# https://www.playframework.com/documentation/3.0.x/PlaySlickAdvancedTopics#Thread-Pool
slick.dbs.default.db.numThreads = 25 # Default is 20
slick.dbs.default.db.maxConnections = 25 # Default is 20
slick.dbs.default.db.minConnections = 2
#slick.dbs.default.db.queueSize = 1000 # Default is 1000
slick.dbs.default.db.connectionTimeout = 30s
slick.dbs.default.db.idleTimeout = 2 minutes # Close connections often to share w/ other cities. Default is 10 minutes.
slick.dbs.default.db.maxLifetime = 30 minutes
# Custom execution context for CPU-intensive operations like data conversion, image processing, etc. Used to prevent
# blocking the main thread pool when doing long-running operations. Slick manages it's own thread pool for the db.
# Some configs explained here: https://pekko.apache.org/docs/pekko/1.1/general/configuration-reference.html
cpu-intensive {
executor = "fork-join-executor"
throughput = 1 # Default is 5.
fork-join-executor {
parallelism-min = 2 # Default is 8. Using fewer long-running threads for CPU-intensive work.
parallelism-factor = 1.0 # Default is 1.0.
parallelism-max = 4 # Default is 64. Using fewer long-running threads for CPU-intensive work.
}
}
# Sets the execution context that Materializer uses for running streams. We tend to use this for the CPU-intensive API.
pekko.stream.materializer.dispatcher = "cpu-intensive"
# Add gzip compression to any text-based responses to improve load times and reduce bandwidth usage.
# https://www.playframework.com/documentation/3.0.x/GzipEncoding
play.filters.enabled += "play.filters.gzip.GzipFilter"
play.filters.gzip {
threshold = 1k # Don't compress responses smaller than this size to avoid unnecessary overhead.
contentType {
whiteList = [
"text/*",
"application/javascript",
"application/json",
"application/xml",
"application/x-protobuf",
"application/geopackage+sqlite3",
"image/svg+xml" // SVGs are text, so they compress well with gzip.
]
}
}
# Add CORS filter to allow cross-origin requests from front ends between cities.
play.filters.enabled += "play.filters.cors.CORSFilter"
play.filters.cors.pathPrefixes = ["/v3/api/"] # Only enable CORS for API endpoints.
# Set up Content Security Policy (CSP) filter.
# NOTE I've set this up to be very basic and to report the violations to the /cspReport endpoint. We aren't actually
# enforcing the CSP yet. It's a sizeable task to set it up properly, but we can work towards it by watching the reports.
# https://www.playframework.com/documentation/3.0.x/CspFilter#Configuring-CSP.
play.filters.enabled += play.filters.csp.CSPFilter
play.filters.csp {
reportOnly = true
directives = {
# Uncomment below when we want the reports sent to our logger. There are too many now for it to be worthwhile.
# report-uri = "/cspReport"
default-src = "'self'"
script-src = "'self' 'unsafe-inline' 'unsafe-eval'"
style-src = "'self' 'unsafe-inline'"
img-src = "'self' data:"
font-src = "'self'"
}
}
# The IP is for makelab1. Not sure why it's not always being resolved to localhost though.
play.filters.hosts.allowed = ["localhost", ".cs.washington.edu", "128.208.6.31"]
# Authentication cookie settings. Updated to share across subdomains (i.e., across cities).
play.http.session {
cookieName = "PROD_PLAY_SESSION"
domain = ".cs.washington.edu"
secure = true
httpOnly = true
sameSite = "lax"
}
# Logger defined in conf/logback.xml. Set this below to be able to use any config properties in the logback.
# https://www.playframework.com/documentation/3.0.x/SettingsLogger
play.logger.includeConfigProperties=true
# API keys and secrets for various services.
mapbox-api-key = ${?MAPBOX_API_KEY}
google-maps-api-key = ${?GOOGLE_MAPS_API_KEY}
google-maps-secret = ${?GOOGLE_MAPS_SECRET}
gemini-api-key = ${?GEMINI_API_KEY}
scistarter-api-key = ${?SCISTARTER_API_KEY}
mapillary-access-token = ${?MAPILLARY_ACCESS_TOKEN}
infra3d-client-id-zurich = ${?INFRA3D_CLIENT_ID_ZURICH}
infra3d-client-id-winterthur = ${?INFRA3D_CLIENT_ID_WINTERTHUR}
infra3d-client-secret-zurich = ${?INFRA3D_CLIENT_SECRET_ZURICH}
infra3d-client-secret-winterthur = ${?INFRA3D_CLIENT_SECRET_WINTERTHUR}
internal-api-key = ${?INTERNAL_API_KEY}
# Sidewalk AI API settings. The ai-enabled flag is only used so that we can disable AI requests in the dev env.
ai-enabled = true
sidewalk-ai-api-hostname = "sidewalk-ai-api.cs.washington.edu"
# Used for sending emails with play-mailer.
play.mailer.host="localhost"
noreply-email-address="noreply@cs.washington.edu"
# For the ability to save crops on the server.
play.http.parser.maxMemoryBuffer = 100M
play.http.parser.maxDiskBuffer = 100M
# Banner link across navbar.
custom.news.ribbon.link = null
# Directory to store cropped images.
cropped.image.directory = ".crops"
cropped.image.directory = ${?SIDEWALK_IMAGES_DIR}
# Directory containing self-hosted pano images, organized as <dir>/<city-id>/<panoId[0:2]>/<panoId>.<ext>.
pano.images.directory = ".panos"
pano.images.directory = ${?SIDEWALK_PANO_DIR}
# Custom error handler.
play.http.errorHandler = "modules.CustomErrorHandler"
include "silhouette.conf"
include "cityparams.conf"