Gitlab CI How can I do variable substitution?

I’m using Gitlab CI/CD to deploy my .netcore application to AWS Beanstalk. How can I update the appSettings.json values in my .netcore application when deploying to different environments using variables defined in my CI/CD pipeline settings?

Azure DevOps has a JSON variable substitution feature which I really liked.

GitHub Actions can also hook into this feature

How can I achieve this with Gitlab CI/CD?

I want to use this method of deployment because

  1. I won’t have to store sensitive production config values in my repository. Values will be updated by Masked variables setup in the CI/CD Pipeline.
  2. I don’t have to rebuild my artefacts every time I deploy to a new environment.

If this can’t be done in Gitlabs, whats the recommended best practice?

thanks