'using different code for different stages and deploying it on AWS ECS

I'm trying to push 2 dockers for ECS: 1 for dev, where I test my code, and one for production. The dockers use a third-party API, where the dev API is different from the prod API. I'm trying to build it locally in a way that I can merge and moved smoothly between stages, and then deploy easily to the right docker.

I've tried that:

  from pygit2 import Repository

repo = Repository('.')
print(f"repo.head:{repo.head}")
if 'main' or 'demo' in repo.head:
    api_var= API_ADDRESS_FOR_PROD
else:
    api_var = API_ADDRESS_FOR_DEV

but the ECS is sending this error:

_pygit2.GitError: Repository not found at .

How can I assign different values to different branches locally, while the ECS accepts them with no error?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source