8000 migrate to LOCALSTACK_AUTH_TOKEN by alexrashed · Pull Request #11767 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content
Dismiss alert
8000

migrate to LOCALSTACK_AUTH_TOKEN #11767

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests-pro-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ jobs:
env:
DEBUG: 1
DNS_ADDRESS: 0
LOCALSTACK_API_KEY: "test"
LOCALSTACK_AUTH_TOKEN: "test"
working-directory: localstack-ext
run: |
source .venv/bin/activate
Expand Down Expand Up @@ -338,7 +338,7 @@ jobs:
DISABLE_BOTO_RETRIES: 1
DNS_ADDRESS: 0
LAMBDA_EXECUTOR: "local"
LOCALSTACK_API_KEY: "test"
LOCALSTACK_AUTH_TOKEN: "test"
AWS_SECRET_ACCESS_KEY: "test"
AWS_ACCESS_KEY_ID: "test"
AWS_DEFAULT_REGION: "us-east-1"
Expand Down
2 changes: 1 addition & 1 deletion localstack-core/localstack/dev/kubernetes/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def generate_k8s_cluster_overrides(
if pro:
extra_env_vars.append(
{
"name": "LOCALSTACK_API_KEY",
"name": "LOCALSTACK_AUTH_TOKEN",
"value": "test",
}
)
Expand Down
4 changes: 2 additions & 2 deletions localstack-core/localstack/dev/run/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def run(

\b
python -m localstack.dev.run
python -m localstack.dev.run -e DEBUG=1 -e LOCALSTACK_API_KEY=test
python -m localstack.dev.run -e DEBUG=1 -e LOCALSTACK_AUTH_TOKEN=test
python -m localstack.dev.run -- bash -c 'echo "hello"'

Explanations and more examples:
Expand All @@ -151,7 +151,7 @@ def run(

If you start localstack-pro, you might also want to add the API KEY as environment variable::

python -m localstack.dev.run -e DEBUG=1 -e LOCALSTACK_API_KEY=test
python -m localstack.dev.run -e DEBUG=1 -e LOCALSTACK_AUTH_TOKEN=test

If your local changes are making modifications to plux plugins (e.g., adding new providers or hooks),
then you also want to mount the newly generated entry_point.txt files into the container::
Expand Down
4 changes: 2 additions & 2 deletions localstack-core/localstack/testing/pytest/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ def __call__(
# handle the convenience options
if pro:
container_configuration.env_vars["GATEWAY_LISTEN"] = "0.0.0.0:4566,0.0.0.0:443"
container_configuration.env_vars["LOCALSTACK_API_KEY"] = os.environ.get(
"LOCALSTACK_API_KEY", "test"
container_configuration.env_vars["LOCALSTACK_AUTH_TOKEN"] = os.environ.get(
"LOCALSTACK_AUTH_TOKEN", "test"
)

# override values from kwargs
Expand Down
7 changes: 4 additions & 3 deletions localstack-core/localstack/utils/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ def get_docker_image_to_start():
image_name = os.environ.get("IMAGE_NAME")
if not image_name:
image_name = constants.DOCKER_IMAGE_NAME
if is_api_key_configured():
if is_auth_token_configured():
image_name = constants.DOCKER_IMAGE_NAME_PRO
return image_name

Expand Down Expand Up @@ -1358,10 +1358,11 @@ def in_ci():
return False


def is_api_key_configured() -> bool:
def is_auth_token_configured() -> bool:
"""Whether an API key is set in the environment."""
return (
True
if os.environ.get("LOCALSTACK_API_KEY") and os.environ.get("LOCALSTACK_API_KEY").strip()
if os.environ.get("LOCALSTACK_AUTH_TOKEN", "").strip()
or os.environ.get("LOCALSTACK_API_KEY", "").strip()
else False
)
1 change: 1 addition & 0 deletions tests/bootstrap/test_container_configurators.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def test_default_localstack_container_configurator(
from localstack import config

monkeypatch.setenv("DEBUG", "1")
monkeypatch.setenv("LOCALSTACK_AUTH_TOKEN", "")
monkeypatch.setenv("LOCALSTACK_API_KEY", "")
monkeypatch.setenv("ACTIVATE_PRO", "0")
monkeypatch.setattr(config, "DEBUG", True)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/cli/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def test_validate_config(runner, monkeypatch, tmp_path):
- SERVICES=${SERVICES- }
- DEBUG=${DEBUG- }
- DATA_DIR=${DATA_DIR- }
- LOCALSTACK_API_KEY=${LOCALSTACK_API_KEY- }
- LOCALSTACK_AUTH_TOKEN=${LOCALSTACK_AUTH_TOKEN- }
- KINESIS_ERROR_PROBABILITY=${KINESIS_ERROR_PROBABILITY- }
- DOCKER_HOST=unix:///var/run/docker.sock
volumes:
Expand Down
Loading
0