I created a new Flex project to be a staging environment for our existing production Flex project. We have a backend service that our flex plugins call, and I've created a staging version of the backend service as well. I want to understand how to have environment-specific configuration in our flex plugins, so that I can deploy the same plugins but point them at different backend service URLs.
It seems there may be three possible options for doing this:
- Change
appConfig.js
to add different configuration, keyed on account id. Possibly this could utilize theTWILIO_ACCOUNT_ID
environment variable whennpm run deploy
is run to add the appropriate configuration, though it's not clear to me how that would work. - Use either the Twilio CLI or the REST API to push a new value like
backend_service_url
to the Flex configuration. Doing that once per project should work. Though I'm not clear on where I would put that in the configuration JSON, and how to read it back in the plugin. - Set up a Twilio function in each project that the plugin calls when it loads, and that returns project-specific configuration.
Please let me know what the best practice would be, and give me a start on how to implement that.