Skip to content

Commit ee3b510

Browse files
authored
make next-gen APIGW provider default (#11035)
1 parent 8ee998a commit ee3b510

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

localstack-core/localstack/config.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,16 +1128,8 @@ def populate_edge_configuration(
11281128
# Whether to really publish to GCM while using SNS Platform Application (needs credentials)
11291129
LEGACY_SNS_GCM_PUBLISHING = is_env_true("LEGACY_SNS_GCM_PUBLISHING")
11301130

1131-
# Whether the Next Gen APIGW invocation logic is enabled (handler chain)
1132-
APIGW_NEXT_GEN_PROVIDER = os.environ.get("PROVIDER_OVERRIDE_APIGATEWAY", "") == "next_gen"
1133-
if APIGW_NEXT_GEN_PROVIDER:
1134-
# in order to not have conflicts with different implementation registering their own router, we need to have all of
1135-
# them use the same new implementation
1136-
if not os.environ.get("PROVIDER_OVERRIDE_APIGATEWAYV2"):
1137-
os.environ["PROVIDER_OVERRIDE_APIGATEWAYV2"] = "next_gen"
1138-
1139-
if not os.environ.get("PROVIDER_OVERRIDE_APIGATEWAYMANAGEMENTAPI"):
1140-
os.environ["PROVIDER_OVERRIDE_APIGATEWAYMANAGEMENTAPI"] = "next_gen"
1131+
# Whether the Next Gen APIGW invocation logic is enabled (on by default)
1132+
APIGW_NEXT_GEN_PROVIDER = os.environ.get("PROVIDER_OVERRIDE_APIGATEWAY", "") in ("next_gen", "")
11411133

11421134
# Whether the DynamoDBStreams native provider is enabled
11431135
DDB_STREAMS_PROVIDER_V2 = os.environ.get("PROVIDER_OVERRIDE_DYNAMODBSTREAMS", "") == "v2"
@@ -1151,7 +1143,6 @@ def populate_edge_configuration(
11511143
os.environ["PROVIDER_OVERRIDE_DYNAMODBSTREAMS"] = "v2"
11521144
DDB_STREAMS_PROVIDER_V2 = True
11531145

1154-
11551146
# TODO remove fallback to LAMBDA_DOCKER_NETWORK with next minor version
11561147
MAIN_DOCKER_NETWORK = os.environ.get("MAIN_DOCKER_NETWORK", "") or LAMBDA_DOCKER_NETWORK
11571148

localstack-core/localstack/services/providers.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ def acm():
1414
return Service.for_provider(provider, dispatch_table_factory=MotoFallbackDispatcher)
1515

1616

17-
@aws_provider(api="apigateway")
17+
@aws_provider()
1818
def apigateway():
19-
from localstack.services.apigateway.legacy.provider import ApigatewayProvider
19+
from localstack.services.apigateway.next_gen.provider import ApigatewayNextGenProvider
2020
from localstack.services.moto import MotoFallbackDispatcher
2121

22-
provider = ApigatewayProvider()
22+
provider = ApigatewayNextGenProvider()
2323
return Service.for_provider(provider, dispatch_table_factory=MotoFallbackDispatcher)
2424

2525

@@ -32,6 +32,15 @@ def apigateway_next_gen():
3232
return Service.for_provider(provider, dispatch_table_factory=MotoFallbackDispatcher)
3333

3434

35+
@aws_provider(api="apigateway", name="legacy")
36+
def apigateway_legacy():
37+
from localstack.services.apigateway.legacy.provider import ApigatewayProvider
38+
from localstack.services.moto import MotoFallbackDispatcher
39+
40+
provider = ApigatewayProvider()
41+
return Service.for_provider(provider, dispatch_table_factory=MotoFallbackDispatcher)
42+
43+
3544
@aws_provider()
3645
def cloudformation():
3746
from localstack.services.cloudformation.provider import CloudformationProvider

0 commit comments

Comments
 (0)