Skip to content

Commit

Permalink
feat: add feature flag for export-api (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomwwinter authored Jan 2, 2025
1 parent 2abbe40 commit 3f8cca6
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import com.aamdigital.aambackendservice.export.core.RenderTemplateUseCase
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import org.slf4j.LoggerFactory
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
Expand Down Expand Up @@ -73,6 +74,12 @@ sealed interface TemplateExportControllerResponse {
*/
@RestController
@RequestMapping("/v1/export")
@ConditionalOnProperty(
prefix = "features.export-api",
name = ["enabled"],
havingValue = "true",
matchIfMissing = false
)
@Validated
class TemplateExportController(
private val createTemplateUseCase: CreateTemplateUseCase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.aamdigital.aambackendservice.export.di
import com.aamdigital.aambackendservice.auth.core.AuthConfig
import com.aamdigital.aambackendservice.auth.core.AuthProvider
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.boot.context.properties.ConfigurationProperties
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
Expand All @@ -12,15 +13,27 @@ import org.springframework.web.client.RestClient


@ConfigurationProperties("aam-render-api-client-configuration")
@ConditionalOnProperty(
prefix = "features.export-api",
name = ["enabled"],
havingValue = "true",
matchIfMissing = false
)
class AamRenderApiClientConfiguration(
val basePath: String,
val authConfig: AuthConfig? = null,
val responseTimeoutInSeconds: Int = 30,
)

@Configuration
@ConditionalOnProperty(
prefix = "features.export-api",
name = ["enabled"],
havingValue = "true",
matchIfMissing = false
)
class AamRenderApiConfiguration {

@Bean(name = ["aam-render-api-client"])
fun aamRenderApiClient(
@Qualifier("aam-keycloak") authProvider: AuthProvider,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ import com.aamdigital.aambackendservice.export.usecase.DefaultFetchTemplateUseCa
import com.aamdigital.aambackendservice.export.usecase.DefaultRenderTemplateUseCase
import com.fasterxml.jackson.databind.ObjectMapper
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.web.client.RestClient

@Configuration
@ConditionalOnProperty(
prefix = "features.export-api",
name = ["enabled"],
havingValue = "true",
matchIfMissing = false
)
class UseCaseConfiguration {
@Bean(name = ["default-template-storage"])
fun defaultTemplateStorage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ management:
probability: 1

features:
export-api:
enabled: false
skill-api:
mode: disabled

Expand All @@ -58,8 +60,8 @@ events:
logging:
logback:
rollingpolicy:
max-file-size: 100MB
total-size-cap: 100MB
max-file-size: 50MB
total-size-cap: 50MB
clean-history-on-start: true

---
Expand Down Expand Up @@ -130,9 +132,14 @@ skilllab-api-client-configuration:
response-timeout-in-seconds: 15

features:
export-api:
enabled: false
skill-api:
mode: skilllab

crypto-configuration:
secret: super-duper-secret

events:
listener:
report-calculation:
Expand All @@ -145,6 +152,10 @@ sentry:
logging:
enabled: false

# sentry version
application:
version: local-dev-build

management:
otlp:
tracing:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ skilllab-api-client-configuration:
response-timeout-in-seconds: 15

features:
export-api:
enabled: true
skill-api:
mode: disabled

Expand All @@ -90,6 +92,10 @@ sentry:
logging:
enabled: false

# sentry version
application:
version: application-e2e-test-build

logging:
level:
com.aamdigital.aambackendservice: trace
com.aamdigital.aambackendservice: warn

0 comments on commit 3f8cca6

Please sign in to comment.