diff --git a/.env.example b/.env.example index 1376e765..1b1b56fd 100644 --- a/.env.example +++ b/.env.example @@ -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 diff --git a/configuration.example.toml b/configuration.example.toml index 6ea94c03..f2b1795f 100644 --- a/configuration.example.toml +++ b/configuration.example.toml @@ -15,3 +15,4 @@ cors-allowed-hosts = [ "*.revanced.app" ] endpoint = "https://api.revanced.app" +old-api-endpoint = "https://old-api.revanced.app" diff --git a/configuration.toml b/configuration.toml deleted file mode 100644 index 37da2608..00000000 --- a/configuration.toml +++ /dev/null @@ -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/" \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/api/configuration/Dependencies.kt b/src/main/kotlin/app/revanced/api/configuration/Dependencies.kt index 3f9f2858..559ac143 100644 --- a/src/main/kotlin/app/revanced/api/configuration/Dependencies.kt +++ b/src/main/kotlin/app/revanced/api/configuration/Dependencies.kt @@ -123,10 +123,11 @@ fun Application.configureDependencies( AuthService(issuer, validityInMin, jwtSecret, authSHA256DigestString) } single { + val configuration = get() + OldApiService( get { - val defaultRequestUri = get()["OLD_API_URL"] - parameterArrayOf(defaultRequestUri) + parameterArrayOf(configuration.oldApiEndpoint) }, ) } diff --git a/src/main/kotlin/app/revanced/api/configuration/repository/ConfigurationRepository.kt b/src/main/kotlin/app/revanced/api/configuration/repository/ConfigurationRepository.kt index 752bccdb..c70b4123 100644 --- a/src/main/kotlin/app/revanced/api/configuration/repository/ConfigurationRepository.kt +++ b/src/main/kotlin/app/revanced/api/configuration/repository/ConfigurationRepository.kt @@ -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, val endpoint: String, + @SerialName("old-api-endpoint") + val oldApiEndpoint: String, ) { /** * An asset configuration.