# Config for the OpencoDE platform
# Token can be an empty string to access public repositories only
opencode.host=https://gitlab.opencode.de/
opencode.access-token=${OC_GL_APIKEY}
opencode.user-name=${OC_GL_USER}
projects.project-ids=${PROJECT_IDS}

# API key to access this server's API
# The api key is needed for all routes.
# the admin password is needed for the repo changed route.
# It is expected as basic auth with the admin username
# details can be found in configuration/security/WebSecurityConfiguration.kt
security.api-key=${API_KEY}
security.admin-password=${ADMIN_PASSWORD}
security.admin-username=${ADMIN_USERNAME}
security.cors-origin=${CORS_ORIGIN}
security.hmac-key=${HMAC_KEY}

# Tool APIs
opencode.api.base-path=https://software.opencode.de/api/v1/project/
opencode.api.ort=/cve-result
opencode.api.auth=https://sl.dev.o4oe.de/api/
opencode.api.auth-api-key=${AUTH_API_KEY}

# OCCMD specific settings
# path to the occmd tool executable
# this can e.g, be the occmd.sh script in this project
occmd.git-clone-target-directory=${GIT_CLONE_TARGET_DIRECTORY}
occmd.occmd-path=${OCCMD_PATH}

# Spring actuator settings
management.server.port=${MANAGEMENT_PORT}
springdoc.use-management-port=true
management.endpoints.web.exposure.include=health,metrics, openapi, swagger-ui, logfile, loggers, prometheus, auditevents
springdoc.show-actuator=true
spring.main.web-application-type=REACTIVE
server.port=${PORT}

# Database Settings
spring.jpa.hibernate.ddl-auto=validate
spring.jpa.properties.hibernate.format_sql=true
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.jpa.properties.hibernate.bytecode.use_reflection_optimizer=false
spring.jpa.open-in-view=false
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.CockroachDialect

# DB settings
spring.datasource.url=jdbc:postgresql://${host}:26257/${DB_USER}?sslmode=${ssl_mode}&sslrootcert=${ca_crt}&sslcert=${ssl_cert}&sslkey=${ssl_key}
spring.datasource.username=${DB_USER}
spring.datasource.driver-class-name=org.postgresql.Driver
# Generates db schema if it doesn't exist in db
spring.jpa.generate-ddl=true
spring.jpa.show-sql=false
#---
spring.config.activate.on-profile=local
opencode.host=https://gitlab.opencode.de/
opencode.analyze-private-repos=true

# Tool APIs
opencode.api.base-path=https://sl.dev.o4oe.de/api/v1/project/
opencode.api.auth=https://sl.dev.o4oe.de/api/receive-session/

# Database Settings
spring.datasource.url=jdbc:postgresql://${host}:${DB_PORT}/${DB_NAME}?sslmode=disable&user=root
spring.jpa.hibernate.ddl-auto=create-drop

# Import local .env
spring.config.import=optional:classpath:.env[.properties]

#---
spring.config.activate.on-profile=dev
# Config for the OpencoDE platform
opencode.host=https://gitlab.dev.o4oe.de/
opencode.analyze-private-repos=true

# Tool APIs
opencode.api.base-path=https://sl.dev.o4oe.de/api/v1/project/
opencode.api.auth=https://sl.dev.o4oe.de/api/

# Database Settings
spring.jpa.hibernate.ddl-auto=update

#---
spring.config.activate.on-profile=prod
