tldr; I want to know what a good strategy could be for developing/testing when an application connects to cloud service.
The issue
I inherited a phoenix application that connects to AWS IoT. I need to do changes an bug fixes.
When I boot up the application in DEV mode on the console (iex -S mix phx.server) errors appear because the connection fails to the AWS IoT service.
The phoenix/elixir/vue application connects to AWS IoT via Tortoise. Tortoise does not give me an option to ‘fake’ the connection, the only thing I could find is verify: :verify_none but that’;s only for the ca certificates, the connection is still being done.
As the application does not boot up because of the errors, it’s hard to make any changes/bug fixes.
Possible solutions I can think of
- using something like LocalStack · GitHub. In that case, connection will be done to a localstack docker container. The production code can stay as is, only need config changes. Issue I have with that is that it is more difficult to mock several scenarios, and pro version is needed, and in a trial period the API keys are not available.
- Mock the Tortoise dep, so I will not really connect, but I will use different code than in production.
Question
So the question is: what is the better way to handle 3rd party connections?
Thx in advance.