#
# Copyright (c) 2021, 2024 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

#
# All Hashicorp Vault configuration is commented out, as this PR only handles OCI
# This should be added in HCP Vault PR
#

server:
  port: 8080

app.token: "argb-urgx-harsps"

vault:
  token: "myroot"
  address: "http://localhost:8200"

security:
  providers:
    - config-vault:
        master-password: "very much secret"
    - vault-kv2:
        address: "${vault.address}"
        token: "${vault.token}"
    - vault-transit:
        address: "${vault.address}"
        token: "${vault.token}"
    # - oci-vault:
        # We need either the cryptographic endpoint (recommended), or management-endpoint configured
        # Also ~/.oci/config must be correctly set up, otherwise all information is required here
        # The crypto endpoint may be configured per digest/encryption, as we may use more than one
        # vault in a single application
        # vault.cryptographic-endpoint: "${oci.properties.cryptographic-endpoint}"
        # vault.management-endpoint: "${oci.properties.management-endpoint}"
  secrets:
    - name: "username"
      provider: "vault-kv2"
      config:
        path: "app/secret"
        key: "username"
#    - name: "changeit"
#      provider: "oci-vault"
#      config:
#        ocid: "${oci.properties.secret-ocid}"
    - name: "token"
      provider: "config-vault"
      config:
        value: "${app.token}"
  digest:
    # Signatures and hmac
    - name: "sig-2"
      provider: "vault-transit"
      config:
        type: "signature"
        key-name: "signature-key"
    - name: "hmac-1"
      provider: "vault-transit"
      config:
        type: "hmac"
        key-name: "encryption-key"
#    - name: "sig-1"
#      provider: "oci-vault"
#      config:
#        cryptographic-endpoint: "${oci.properties.cryptographic-endpoint}"
#        key-ocid: "${oci.properties.vault-rsa-key-ocid}"
#        algorithm: "SHA_256_RSA_PKCS_PSS"
  encryption:
    # encryption and decryption
    - name: "crypto-3"
      provider: "vault-transit"
      config:
        key-name: "encryption-key"
#    - name: "crypto-1"
#      provider: "oci-vault"
#      config:
#        cryptographic-endpoint: "${oci.properties.cryptographic-endpoint}"
#        key-ocid: "${oci.properties.vault-key-ocid}"
    - name: "crypto-2"
      provider: "config-vault"
