workadventure icon indicating copy to clipboard operation
workadventure copied to clipboard

Make TURN credentials renewal time configurable via environment variable

Open Copilot opened this issue 2 months ago • 2 comments

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 to FRONT_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.ts into 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 avatar Dec 11 '25 09:12 Copilot

@copilot Thanks. Can you simply rename the variable to TURN_CREDENTIALS_RENEWAL_TIME? (as this is really TURN specific)

moufmouf avatar Dec 11 '25 09:12 moufmouf

@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.

Copilot avatar Dec 11 '25 09:12 Copilot