mirror of
https://github.com/revanced/revanced-api.git
synced 2025-05-20 08:07:05 +02:00
fix: Move old API endpoint configuration from env to configuration file
This commit is contained in:
parent
8f77736a69
commit
7e99e49af2
@ -1,7 +1,5 @@
|
||||
# Optional token for API calls to the backend
|
||||
BACKEND_API_TOKEN=
|
||||
# A URL to the old API to proxy for migration purposes
|
||||
OLD_API_URL=
|
||||
|
||||
# Database connection details
|
||||
DB_URL=jdbc:h2:./persistence/revanced-api
|
||||
|
@ -15,3 +15,4 @@ cors-allowed-hosts = [
|
||||
"*.revanced.app"
|
||||
]
|
||||
endpoint = "https://api.revanced.app"
|
||||
old-api-endpoint = "https://old-api.revanced.app"
|
||||
|
@ -1,14 +0,0 @@
|
||||
organization = "revanced"
|
||||
patches = { repository = "revanced-patches", asset-regex = "jar$", signature-asset-regex = "asc$", public-key-file = "key.asc" }
|
||||
integrations = { repository = "revanced-integrations", asset-regex = "apk$", signature-asset-regex = "asc$", public-key-file = "key.asc" }
|
||||
contributors-repositories = [
|
||||
"revanced-patcher",
|
||||
"revanced-patches",
|
||||
"revanced-integrations",
|
||||
"revanced-website",
|
||||
"revanced-cli",
|
||||
"revanced-manager",
|
||||
]
|
||||
api-version = 1
|
||||
cors = { host = "*.127.0.0.1:8888", sub-domains = [] }
|
||||
endpoint = "http://127.0.0.1:8888/"
|
@ -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)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user