fix: Move old API endpoint configuration from env to configuration file

This commit is contained in:
oSumAtrIX
2024-07-11 04:26:26 +02:00
parent 8f77736a69
commit 7e99e49af2
5 changed files with 7 additions and 18 deletions

View File

@@ -123,10 +123,11 @@ fun Application.configureDependencies(
AuthService(issuer, validityInMin, jwtSecret, authSHA256DigestString)
}
single {
val configuration = get<ConfigurationRepository>()
OldApiService(
get {
val defaultRequestUri = get<Dotenv>()["OLD_API_URL"]
parameterArrayOf(defaultRequestUri)
parameterArrayOf(configuration.oldApiEndpoint)
},
)
}

View File

@@ -21,6 +21,7 @@ import java.io.File
* @property apiVersion The version to use for the API.
* @property corsAllowedHosts The hosts allowed to make requests to the API.
* @property endpoint The endpoint of the API.
* @property oldApiEndpoint The endpoint of the old API to proxy requests to.
*/
@Serializable
internal class ConfigurationRepository(
@@ -34,6 +35,8 @@ internal class ConfigurationRepository(
@SerialName("cors-allowed-hosts")
val corsAllowedHosts: Set<String>,
val endpoint: String,
@SerialName("old-api-endpoint")
val oldApiEndpoint: String,
) {
/**
* An asset configuration.