api-version: 2024-02-02-preview
location: {{ .Env.AZURE_LOCATION }}
identity:
  type: UserAssigned
  userAssignedIdentities:
    ? "{{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}"
    : {}
properties:
  environmentId: {{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_ID }}
  configuration:
    activeRevisionsMode: single
    runtime:
      dotnet:
        autoConfigureDataProtection: true
    ingress:
      external: true
      targetPort: {{ targetPortOrDefault 8080 }}
      transport: http
      allowInsecure: false
    registries:
      - server: {{ .Env.AZURE_CONTAINER_REGISTRY_ENDPOINT }}
        identity: {{ .Env.AZURE_CONTAINER_REGISTRY_MANAGED_IDENTITY_ID }}
    secrets:
      - name: cache-password
        value: '{{ securedParameter "cache_password" }}'
      - name: connectionstrings--cache
        value: cache:6379,password={{ securedParameter "cache_password" }}
      - name: connectionstrings--phi35
        value: Endpoint=http://ollama.internal.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}:80;Model=phi3.5
  template:
    containers:
      - image: {{ .Image }}
        name: webfrontend
        env:
          - name: AZURE_CLIENT_ID
            value: {{ .Env.MANAGED_IDENTITY_CLIENT_ID }}
          - name: APISERVICE_HTTP
            value: http://apiservice.internal.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
          - name: APISERVICE_HTTPS
            value: https://apiservice.internal.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
          - name: ASPNETCORE_FORWARDEDHEADERS_ENABLED
            value: "true"
          - name: CACHE_HOST
            value: cache
          - name: CACHE_PORT
            value: "6379"
          - name: CACHE_URI
            value: redis://:{{ uriEncode (securedParameter "cache_password" )}}@cache:6379
          - name: HTTP_PORTS
            value: '{{ targetPortOrDefault 0 }}'
          - name: IDP_HTTP
            value: http://idp.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
          - name: Identity__ClientSecret
            value: some_secret
          - name: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EVENT_LOG_ATTRIBUTES
            value: "true"
          - name: OTEL_DOTNET_EXPERIMENTAL_OTLP_EMIT_EXCEPTION_LOG_ATTRIBUTES
            value: "true"
          - name: OTEL_DOTNET_EXPERIMENTAL_OTLP_RETRY
            value: in_memory
          - name: PHI35_HOST
            value: ollama.internal.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
          - name: PHI35_MODEL
            value: phi3.5
          - name: PHI35_PORT
            value: "80"
          - name: PHI35_URI
            value: http://ollama.internal.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}:80
          - name: services__apiservice__http__0
            value: http://apiservice.internal.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
          - name: services__apiservice__https__0
            value: https://apiservice.internal.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
          - name: services__idp__http__0
            value: http://idp.{{ .Env.AZURE_CONTAINER_APPS_ENVIRONMENT_DEFAULT_DOMAIN }}
          - name: CACHE_PASSWORD
            secretRef: cache-password
          - name: ConnectionStrings__cache
            secretRef: connectionstrings--cache
          - name: ConnectionStrings__phi35
            secretRef: connectionstrings--phi35
    scale:
      minReplicas: 1
tags:
  azd-service-name: webfrontend
  aspire-resource-name: webfrontend
