Make TURN credentials renewal time configurable via environment variable
The TURN server credentials renewal interval was hardcoded to 3 hours in IceServersManager.ts. This is now configurable via the TURN_CREDENTIALS_RENEWAL_TIME environment variable.
Changes
-
Added environment variable:
TURN_CREDENTIALS_RENEWAL_TIME(milliseconds, defaults to 10800000 = 3 hours) -
Configuration flow: Environment variable → Zod validator → Pusher backend → Frontend configuration →
IceServersManager -
Modified files:
-
play/src/pusher/enums/EnvironmentVariableValidator.ts- Added validation schema -
play/src/pusher/enums/EnvironmentVariable.ts- Exported variable and added toFRONT_ENVIRONMENT_VARIABLES -
play/src/common/FrontConfigurationInterface.ts- Added type definition -
play/src/front/Enum/EnvironmentVariable.ts- Exposed to frontend -
play/src/front/WebRtc/IceServersManager.ts- Replaced constant with environment variable -
.env.template- Added configuration example
-
Usage
# .env or Docker environment
TURN_CREDENTIALS_RENEWAL_TIME=7200000 # 2 hours
The value controls how frequently TURN credentials are renewed. Default maintains existing 3-hour behavior.
Original prompt
Please turn the CREDENTIALS_RENEWAL_TIME const in
play/src/front/WebRtc/IceServersManager.tsinto a configurable environment variable in the play container.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.
@copilot Thanks. Can you simply rename the variable to TURN_CREDENTIALS_RENEWAL_TIME? (as this is really TURN specific)
@copilot Thanks. Can you simply rename the variable to
TURN_CREDENTIALS_RENEWAL_TIME? (as this is really TURN specific)
Done! Renamed to TURN_CREDENTIALS_RENEWAL_TIME in commit 14359f7.