generated from CDCgov/template
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
15864 Spring Cloud Gate configuration with Swagger (#16292)
- Loading branch information
Showing
17 changed files
with
130 additions
and
301 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
auth/src/main/kotlin/gov/cdc/prime/reportstream/auth/AuthApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 6 additions & 17 deletions
23
auth/src/main/kotlin/gov/cdc/prime/reportstream/auth/config/ApplicationConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,21 @@ | ||
package gov.cdc.prime.reportstream.auth.config | ||
|
||
import gov.cdc.prime.reportstream.auth.model.Environment | ||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties | ||
import org.springframework.boot.context.properties.bind.ConstructorBinding | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import kotlin.time.TimeSource | ||
|
||
/** | ||
* Simple class to automatically read configuration from application.yml (or environment variable overrides) | ||
*/ | ||
@Configuration | ||
@EnableConfigurationProperties(ProxyConfigurationProperties::class) | ||
class ApplicationConfig( | ||
val proxyConfig: ProxyConfigurationProperties, | ||
@ConfigurationProperties(prefix = "app") | ||
data class ApplicationConfig @ConstructorBinding constructor( | ||
val environment: Environment, | ||
) { | ||
|
||
@Bean | ||
fun timeSource(): TimeSource { | ||
return TimeSource.Monotonic | ||
} | ||
} | ||
|
||
@ConfigurationProperties("proxy") | ||
data class ProxyConfigurationProperties( | ||
val pathMappings: List<ProxyPathMapping>, | ||
) | ||
|
||
data class ProxyPathMapping( | ||
val baseUrl: String, | ||
val pathPrefix: String, | ||
) | ||
} |
27 changes: 27 additions & 0 deletions
27
auth/src/main/kotlin/gov/cdc/prime/reportstream/auth/config/RouteConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package gov.cdc.prime.reportstream.auth.config | ||
|
||
import gov.cdc.prime.reportstream.auth.AuthApplicationConstants | ||
import org.springframework.cloud.gateway.route.RouteLocator | ||
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
|
||
/** | ||
* Configuration class to set up route forwarding | ||
*/ | ||
@Configuration | ||
class RouteConfig( | ||
private val submissionsConfig: SubmissionsConfig, | ||
) { | ||
|
||
@Bean | ||
fun routes(builder: RouteLocatorBuilder): RouteLocator { | ||
return builder.routes() | ||
.route { | ||
it | ||
.path(AuthApplicationConstants.SubmissionsEndpoints.REPORTS_ENDPOINT_V1) | ||
.uri(submissionsConfig.baseUrl) | ||
} | ||
.build() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
auth/src/main/kotlin/gov/cdc/prime/reportstream/auth/config/SubmissionsConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package gov.cdc.prime.reportstream.auth.config | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.boot.context.properties.bind.ConstructorBinding | ||
|
||
/** | ||
* Configuration for Submissions microservice | ||
*/ | ||
@ConfigurationProperties(prefix = "submissions") | ||
data class SubmissionsConfig @ConstructorBinding constructor( | ||
val baseUrl: String, | ||
) |
47 changes: 0 additions & 47 deletions
47
auth/src/main/kotlin/gov/cdc/prime/reportstream/auth/controller/AuthController.kt
This file was deleted.
Oops, something went wrong.
10 changes: 10 additions & 0 deletions
10
auth/src/main/kotlin/gov/cdc/prime/reportstream/auth/model/Environment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package gov.cdc.prime.reportstream.auth.model | ||
|
||
/** | ||
* All possible environments the auth app can be running | ||
*/ | ||
enum class Environment { | ||
LOCAL, | ||
STAGING, | ||
PRODUCTION, | ||
} |
55 changes: 0 additions & 55 deletions
55
auth/src/main/kotlin/gov/cdc/prime/reportstream/auth/service/ProxyURIStrategy.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.