• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

localstack / localstack / 7fa8d294-7151-46d9-bdb8-9eeb2e68bf97

06 Mar 2025 07:01PM UTC coverage: 86.892% (+0.03%) from 86.862%
7fa8d294-7151-46d9-bdb8-9eeb2e68bf97

push

circleci

web-flow
remove APIGW CORS handler and update global CORS logic (#11801)

4 of 4 new or added lines in 1 file covered. (100.0%)

20 existing lines in 6 files now uncovered.

61902 of 71240 relevant lines covered (86.89%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

96.1
/localstack-core/localstack/constants.py
1
import os
1✔
2

3
from localstack.version import __version__
1✔
4

5
VERSION = __version__
1✔
6

7
# HTTP headers used to forward proxy request URLs
8
HEADER_LOCALSTACK_EDGE_URL = "x-localstack-edge"
1✔
9
HEADER_LOCALSTACK_REQUEST_URL = "x-localstack-request-url"
1✔
10
# xXx custom localstack authorization header only used in ext
11
HEADER_LOCALSTACK_AUTHORIZATION = "x-localstack-authorization"
1✔
12
HEADER_LOCALSTACK_TARGET = "x-localstack-target"
1✔
13
HEADER_AMZN_ERROR_TYPE = "X-Amzn-Errortype"
1✔
14

15
# backend service ports, for services that are behind a proxy (counting down from 4566)
16
DEFAULT_PORT_EDGE = 4566
1✔
17

18
# host name for localhost
19
LOCALHOST = "localhost"
1✔
20
LOCALHOST_IP = "127.0.0.1"
1✔
21
LOCALHOST_HOSTNAME = "localhost.localstack.cloud"
1✔
22

23
# User-agent string used in outgoing HTTP requests made by LocalStack
24
USER_AGENT_STRING = f"localstack/{VERSION}"
1✔
25

26
# version of the Maven dependency with Java utility code
27
LOCALSTACK_MAVEN_VERSION = "0.2.21"
1✔
28
MAVEN_REPO_URL = "https://repo1.maven.org/maven2"
1✔
29

30
# URL of localstack's artifacts repository on GitHub
31
ARTIFACTS_REPO = "https://github.com/localstack/localstack-artifacts"
1✔
32

33
# Artifacts endpoint
34
ASSETS_ENDPOINT = "https://assets.localstack.cloud"
1✔
35

36
# Hugging Face endpoint for localstack
37
HUGGING_FACE_ENDPOINT = "https://huggingface.co/localstack"
1✔
38

39
# host to bind to when starting the services
40
BIND_HOST = "0.0.0.0"
1✔
41

42
# root code folder
43
MODULE_MAIN_PATH = os.path.dirname(os.path.realpath(__file__))
1✔
44
# TODO rename to "ROOT_FOLDER"!
45
LOCALSTACK_ROOT_FOLDER = os.path.realpath(os.path.join(MODULE_MAIN_PATH, ".."))
1✔
46

47
# virtualenv folder
48
LOCALSTACK_VENV_FOLDER = os.environ.get("VIRTUAL_ENV")
1✔
49
if not LOCALSTACK_VENV_FOLDER:
1✔
50
    # fallback to the previous logic
51
    LOCALSTACK_VENV_FOLDER = os.path.join(LOCALSTACK_ROOT_FOLDER, ".venv")
×
UNCOV
52
    if not os.path.isdir(LOCALSTACK_VENV_FOLDER):
×
53
        # assuming this package lives here: <python>/lib/pythonX.X/site-packages/localstack/
UNCOV
54
        LOCALSTACK_VENV_FOLDER = os.path.realpath(
×
55
            os.path.join(LOCALSTACK_ROOT_FOLDER, "..", "..", "..")
56
        )
57

58
# default volume directory containing shared data
59
DEFAULT_VOLUME_DIR = "/var/lib/localstack"
1✔
60

61
# API Gateway path to indicate a user request sent to the gateway
62
PATH_USER_REQUEST = "_user_request_"
1✔
63

64
# name of LocalStack Docker image
65
DOCKER_IMAGE_NAME = "localstack/localstack"
1✔
66
DOCKER_IMAGE_NAME_PRO = "localstack/localstack-pro"
1✔
67
DOCKER_IMAGE_NAME_FULL = "localstack/localstack-full"
1✔
68

69
# backdoor API path used to retrieve or update config variables
70
CONFIG_UPDATE_PATH = "/?_config_"
1✔
71

72
# API path for localstack internal resources
73
INTERNAL_RESOURCE_PATH = "/_localstack"
1✔
74

75
# environment variable name to tag local test runs
76
ENV_INTERNAL_TEST_RUN = "LOCALSTACK_INTERNAL_TEST_RUN"
1✔
77

78
# environment variable name to tag collect metrics during a test run
79
ENV_INTERNAL_TEST_COLLECT_METRIC = "LOCALSTACK_INTERNAL_TEST_COLLECT_METRIC"
1✔
80

81
# environment variable that flags whether pro was activated. do not use it for security purposes!
82
ENV_PRO_ACTIVATED = "PRO_ACTIVATED"
1✔
83

84
# content types / encodings
85
HEADER_CONTENT_TYPE = "Content-Type"
1✔
86
TEXT_XML = "text/xml"
1✔
87
APPLICATION_AMZ_JSON_1_0 = "application/x-amz-json-1.0"
1✔
88
APPLICATION_AMZ_JSON_1_1 = "application/x-amz-json-1.1"
1✔
89
APPLICATION_AMZ_CBOR_1_1 = "application/x-amz-cbor-1.1"
1✔
90
APPLICATION_CBOR = "application/cbor"
1✔
91
APPLICATION_JSON = "application/json"
1✔
92
APPLICATION_XML = "application/xml"
1✔
93
APPLICATION_OCTET_STREAM = "application/octet-stream"
1✔
94
APPLICATION_X_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"
1✔
95
HEADER_ACCEPT_ENCODING = "Accept-Encoding"
1✔
96

97
# strings to indicate truthy/falsy values
98
TRUE_STRINGS = ("1", "true", "True")
1✔
99
FALSE_STRINGS = ("0", "false", "False")
1✔
100
# strings with valid log levels for LS_LOG
101
LOG_LEVELS = ("trace-internal", "trace", "debug", "info", "warn", "error", "warning")
1✔
102

103
# the version of elasticsearch that is pre-seeded into the base image (sync with Dockerfile.base)
104
ELASTICSEARCH_DEFAULT_VERSION = "Elasticsearch_7.10"
1✔
105
# See https://docs.aws.amazon.com/ja_jp/elasticsearch-service/latest/developerguide/aes-supported-plugins.html
106
ELASTICSEARCH_PLUGIN_LIST = [
1✔
107
    "analysis-icu",
108
    "ingest-attachment",
109
    "analysis-kuromoji",
110
    "mapper-murmur3",
111
    "mapper-size",
112
    "analysis-phonetic",
113
    "analysis-smartcn",
114
    "analysis-stempel",
115
    "analysis-ukrainian",
116
]
117
# Default ES modules to exclude (save apprx 66MB in the final image)
118
ELASTICSEARCH_DELETE_MODULES = ["ingest-geoip"]
1✔
119

120
# the version of opensearch which is used by default
121
OPENSEARCH_DEFAULT_VERSION = "OpenSearch_2.11"
1✔
122

123
# See https://docs.aws.amazon.com/opensearch-service/latest/developerguide/supported-plugins.html
124
OPENSEARCH_PLUGIN_LIST = [
1✔
125
    "ingest-attachment",
126
    "analysis-kuromoji",
127
]
128

129
# API endpoint for analytics events
130
API_ENDPOINT = os.environ.get("API_ENDPOINT") or "https://api.localstack.cloud/v1"
1✔
131
# new analytics API endpoint
132
ANALYTICS_API = os.environ.get("ANALYTICS_API") or "https://analytics.localstack.cloud/v1"
1✔
133

134
# environment variable to indicate this process should run the localstack infrastructure
135
LOCALSTACK_INFRA_PROCESS = "LOCALSTACK_INFRA_PROCESS"
1✔
136

137
# AWS region us-east-1
138
AWS_REGION_US_EAST_1 = "us-east-1"
1✔
139

140
# environment variable to override max pool connections
141
try:
1✔
142
    MAX_POOL_CONNECTIONS = int(os.environ["MAX_POOL_CONNECTIONS"])
1✔
143
except Exception:
1✔
144
    MAX_POOL_CONNECTIONS = 150
1✔
145

146
# Fallback Account ID if not available in the client request
147
DEFAULT_AWS_ACCOUNT_ID = "000000000000"
1✔
148

149
# Credentials used for internal calls
150
INTERNAL_AWS_ACCESS_KEY_ID = "__internal_call__"
1✔
151
INTERNAL_AWS_SECRET_ACCESS_KEY = "__internal_call__"
1✔
152

153
# trace log levels (excluding/including internal API calls), configurable via $LS_LOG
154
LS_LOG_TRACE = "trace"
1✔
155
LS_LOG_TRACE_INTERNAL = "trace-internal"
1✔
156
TRACE_LOG_LEVELS = [LS_LOG_TRACE, LS_LOG_TRACE_INTERNAL]
1✔
157

158
# list of official docker images
159
OFFICIAL_IMAGES = [
1✔
160
    "localstack/localstack",
161
    "localstack/localstack-pro",
162
]
163

164
# port for debug py
165
DEFAULT_DEVELOP_PORT = 5678
1✔
166

167
# Default bucket name of the s3 bucket used for local lambda development
168
# This name should be accepted by all IaC tools, so should respect s3 bucket naming conventions
169
DEFAULT_BUCKET_MARKER_LOCAL = "hot-reload"
1✔
170
LEGACY_DEFAULT_BUCKET_MARKER_LOCAL = "__local__"
1✔
171

172
# user that starts the opensearch process if the current user is root
173
OS_USER_OPENSEARCH = "localstack"
1✔
174

175
# output string that indicates that the stack is ready
176
READY_MARKER_OUTPUT = "Ready."
1✔
177

178
# Regex for `Credential` field in the Authorization header in AWS signature version v4
179
# The format is as follows:
180
#   Credential=<access-key-id>/<date>/<region-name>/<service-name>/aws4_request
181
# eg.
182
#   Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/s3/aws4_request
183
AUTH_CREDENTIAL_REGEX = r"Credential=(?P<access_key_id>[a-zA-Z0-9-_.]{1,})/(?P<date>\d{8})/(?P<region_name>[a-z0-9-]{1,})/(?P<service_name>[a-z0-9]{1,})/"
1✔
184

185
# Custom resource tag to override the generated resource ID.
186
TAG_KEY_CUSTOM_ID = "_custom_id_"
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc