diff --git a/ci/deploy-k8s-aws/app-specs/configmap-uni-resolver-frontend.yaml b/ci/deploy-k8s-aws/app-specs/configmap-uni-resolver-frontend.yaml index 3afebb6b2..bdaa14a64 100644 --- a/ci/deploy-k8s-aws/app-specs/configmap-uni-resolver-frontend.yaml +++ b/ci/deploy-k8s-aws/app-specs/configmap-uni-resolver-frontend.yaml @@ -3,4 +3,4 @@ kind: ConfigMap metadata: name: uni-resolver-frontend data: - backend_url: https://did.civic.com/ + backend_url: {{backendUrl}} diff --git a/ci/deploy-k8s-aws/scripts/prepare-deployment.py b/ci/deploy-k8s-aws/scripts/prepare-deployment.py index 42888b153..82846eb0b 100755 --- a/ci/deploy-k8s-aws/scripts/prepare-deployment.py +++ b/ci/deploy-k8s-aws/scripts/prepare-deployment.py @@ -202,18 +202,28 @@ def generate_ingress(containers, outputdir, deploymentdomain): fout.close() -def copy_app_deployment_specs(outputdir): +def copy_app_deployment_specs(outputdir, deploymentdomain): print('#### Current python working path') working_path = pathlib.Path().absolute() print(working_path) # Configmap has to be deployed before the applications - copy('/app-specs/configmap-uni-resolver-frontend.yaml', outputdir + '/configmap-uni-resolver-frontend.yaml') + replace_and_copy('/app-specs/configmap-uni-resolver-frontend.yaml', outputdir + '/configmap-uni-resolver-frontend.yaml', 'backendUrl', deploymentdomain) add_deployment('configmap-uni-resolver-frontend.yaml', outputdir) copy('/app-specs/deployment-uni-resolver-frontend.yaml', outputdir + '/deployment-uni-resolver-frontend.yaml') add_deployment('deployment-uni-resolver-frontend.yaml', outputdir) copy('/app-specs/deployment-uni-resolver-web.yaml', outputdir + '/deployment-uni-resolver-web.yaml') add_deployment('deployment-uni-resolver-web.yaml', outputdir) +def replace_and_copy(infile, outfile, templateKey, value): + fin = open(infile, "r") + fout = open(outfile, "w") + for line in fin: + print('Replacing ' + '{{' + templateKey + '}}' + ' with ' + value) + fout.write(line.replace('{{' + templateKey + '}}', value)) + fout.close() + fin.close() + + def main(argv): print('#### Current python script path') absolute_path = pathlib.Path(__file__).parent.absolute() @@ -258,7 +268,7 @@ def main(argv): generate_deployment_specs(containers, outputdir) # copy app deployment specs - copy_app_deployment_specs(outputdir) + copy_app_deployment_specs(outputdir, deploymentdomain) # copy namespace files copy('/namespace/namespace-setup.yaml', './deploy/namespace-setup.yaml')