How to Dynamically set the Redirect Url to the Front end? Google Provider

How to set a dynamic url in the redirect URL section.

In local environment i want it to be “http://localhost:3000” and in production this needs to be “

Anyone know how to achieve this? My best guess is to change this file:

How to change this and check for local or development environment? Thanks in advance.

I was able to fix it myself by editing the extensions/users-permissions/server/controllers/auth.js file.

the extensions/strapi-server.js file: