diff --git a/.github/workflows/deploy_fastapi_backend.yml b/.github/workflows/deploy_fastapi_backend.yml index 3f224fd9..4fc11b19 100644 --- a/.github/workflows/deploy_fastapi_backend.yml +++ b/.github/workflows/deploy_fastapi_backend.yml @@ -63,6 +63,20 @@ jobs: run: | echo "::set-output name=ecr_uri::${{ secrets[format('{0}_ECR_URI', github.ref_name)] }}" + - name: Set Secrets + id: set_api_secrets + run: | + echo "::set-output name=sap_predictions_bucket::${{ secrets[format('{0}_SAP_PREDICTIONS_BUCKET', github.ref_name)] }}" + echo "::set-output name=carbon_predictions_bucket::${{ secrets[format('{0}_CARBON_PREDICTIONS_BUCKET', github.ref_name)] }}" + echo "::set-output name=heat_predictions_bucket::${{ secrets[format('{0}_HEAT_PREDICTIONS_BUCKET', github.ref_name)] }}" + echo "::set-output name=lighting_cost_predictions_bucket::${{ secrets[format('{0}_LIGHTING_COST_PREDICTIONS_BUCKET', github.ref_name)] }}" + echo "::set-output name=heating_cost_predictions_bucket::${{ secrets[format('{0}_HEATING_COST_PREDICTIONS_BUCKET', github.ref_name)] }}" + echo "::set-output name=hot_water_cost_predictions_bucket::${{ secrets[format('{0}_HOT_WATER_COST_PREDICTIONS_BUCKET', github.ref_name)] }}" + echo "::set-output name=heating_kwh_predictions_bucket::${{ secrets[format('{0}_HEATING_KWH_PREDICTIONS_BUCKET', github.ref_name)] }}" + echo "::set-output name=hotwater_kwh_predictions_bucket::${{ secrets[format('{0}_HOTWATER_KWH_PREDICTIONS_BUCKET', github.ref_name)] }}" + echo "::set-output name=energy_asessments_bucket::${{ secrets[format('{0}_ENERGY_ASSESSMENTS_BUCKET', github.ref_name)] }}" + echo "::set-output name=google_solar_api_key::${{ secrets[format('{0}_GOOGLE_SOLAR_API_KEY', github.ref_name)] }}" + - name: Setup Docker uses: docker/setup-buildx-action@v1 @@ -91,6 +105,16 @@ jobs: PLAN_TRIGGER_BUCKET: 'retrofit-plan-inputs-${{ github.ref_name }}' DATA_BUCKET: 'retrofit-data-${{ github.ref_name }}' PREDICTIONS_BUCKET: 'retrofit-sap-predictions-${{ github.ref_name }}' + SAP_PREDICTIONS_BUCKET: ${{ steps.set_api_secrets.outputs.sap_predictions_bucket }} + CARBON_PREDICTIONS_BUCKET: ${{ steps.set_api_secrets.outputs.carbon_predictions_bucket }} + HEAT_PREDICTIONS_BUCKET: ${{ steps.set_api_secrets.outputs.heat_predictions_bucket }} + LIGHTING_COST_PREDICTIONS_BUCKET: ${{ steps.set_api_secrets.outputs.lighting_cost_predictions_bucket }} + HEATING_COST_PREDICTIONS_BUCKET: ${{ steps.set_api_secrets.outputs.heating_cost_predictions_bucket }} + HOT_WATER_COST_PREDICTIONS_BUCKET: ${{ steps.set_api_secrets.outputs.hot_water_cost_predictions_bucket }} + HEATING_KWH_PREDICTIONS_BUCKET: ${{ steps.set_api_secrets.outputs.heating_kwh_predictions_bucket }} + HOTWATER_KWH_PREDICTIONS_BUCKET: ${{ steps.set_api_secrets.outputs.hotwater_kwh_predictions_bucket }} + ENERGY_ASSESSMENTS_BUCKET: ${{ steps.set_api_secrets.outputs.energy_asessments_bucket }} + GOOGLE_SOLAR_API_KEY: ${{ steps.set_api_secrets.outputs.google_solar_api_key }} DOMAIN_NAME: ${{ steps.set_domain.outputs.domain }} EPC_AUTH_TOKEN: ${{ steps.set_auth_token.outputs.auth_token }} DB_HOST: ${{ steps.set_db_credentials.outputs.db_host }} diff --git a/.idea/Model.iml b/.idea/Model.iml index 850c0cda..df6c4faa 100644 --- a/.idea/Model.iml +++ b/.idea/Model.iml @@ -7,7 +7,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index e4070118..50cad4ca 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -3,7 +3,7 @@ - + diff --git a/backend/app/config.py b/backend/app/config.py index 21e8f21c..7ac2911a 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -12,9 +12,7 @@ class Settings(BaseSettings): # Third parties EPC_AUTH_TOKEN: str - ORDNANCE_SURVEY_API_KEY: str GOOGLE_SOLAR_API_KEY: str - FARADAY_API_KEY: str # Database settings DB_HOST: str diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 26c84c81..119c2061 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -412,7 +412,7 @@ async def trigger_plan(body: PlanTriggerRequest): postcode=config["postcode"], uprn=uprn, auth_token=get_settings().EPC_AUTH_TOKEN, - os_api_key=get_settings().ORDNANCE_SURVEY_API_KEY, + os_api_key="", ) epc_searcher.ordnance_survey_client.built_form = config.get("built_form", None) epc_searcher.ordnance_survey_client.property_type = config.get("property_type", None) diff --git a/serverless.yml b/serverless.yml index 98f6ca59..14916629 100644 --- a/serverless.yml +++ b/serverless.yml @@ -20,6 +20,16 @@ provider: DB_PORT: ${env:DB_PORT} ECR_URI: ${env:ECR_URI} GITHUB_SHA: ${env:GITHUB_SHA} + SAP_PREDICTIONS_BUCKET: ${env:SAP_PREDICTIONS_BUCKET} + CARBON_PREDICTIONS_BUCKET: ${env:CARBON_PREDICTIONS_BUCKET} + HEAT_PREDICTIONS_BUCKET: ${env:HEAT_PREDICTIONS_BUCKET} + LIGHTING_COST_PREDICTIONS_BUCKET: ${env:LIGHTING_COST_PREDICTIONS_BUCKET} + HEATING_COST_PREDICTIONS_BUCKET: ${env:HEATING_COST_PREDICTIONS_BUCKET} + HOT_WATER_COST_PREDICTIONS_BUCKET: ${env:HOT_WATER_COST_PREDICTIONS_BUCKET} + HEATING_KWH_PREDICTIONS_BUCKET: ${env:HEATING_KWH_PREDICTIONS_BUCKET} + HOTWATER_KWH_PREDICTIONS_BUCKET: ${env:HOTWATER_KWH_PREDICTIONS_BUCKET} + ENERGY_ASSESSMENTS_BUCKET: ${env:ENERGY_ASSESSMENTS_BUCKET} + GOOGLE_SOLAR_API_KEY: ${env:GOOGLE_SOLAR_API_KEY} # Give lambda access to read from the bucket iam: role: