Skip to content

Commit

Permalink
Debug in intelliJ only
Browse files Browse the repository at this point in the history
  • Loading branch information
s4nchez committed Oct 5, 2020
1 parent c2d3ae8 commit 56ac5b9
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ import org.http4k.core.Status.Companion.OK
import org.http4k.core.then
import org.http4k.filter.AwsAuth
import org.http4k.filter.ClientFilters
import org.http4k.filter.DebuggingFilters
import org.http4k.serverless.lambda.client.ApiName
import org.http4k.serverless.lambda.client.AwsApiGatewayApiClient
import org.http4k.serverless.lambda.client.Config
import org.http4k.serverless.lambda.client.Stage
import org.junit.jupiter.api.fail
import java.lang.management.ManagementFactory
import java.time.Duration
import java.time.Instant

Expand All @@ -28,8 +30,7 @@ class DeployApiGateway {
private val region = Config.region(config)

private val client =
Filter.NoOp
// .then(DebuggingFilters.PrintRequestAndResponse())
inIntelliJOnly(DebuggingFilters.PrintRequestAndResponse())
.then(AwsApiGatewayApiClient.ApiGatewayApi(region)) //TODO delete once all calls are moved into client
.then(ClientFilters.AwsAuth(scope(config), Config.credentials(config)))
.then(JavaHttpClient())
Expand Down Expand Up @@ -86,3 +87,8 @@ fun waitUntil(
}
} while (!success)
}

private fun inIntelliJOnly(filter: Filter) =
if (ManagementFactory.getRuntimeMXBean().inputArguments.find { it.contains("idea", true) } != null)
filter
else Filter.NoOp

0 comments on commit 56ac5b9

Please sign in to comment.