Skip to content

Commit

Permalink
Use metadata V3 URI
Browse files Browse the repository at this point in the history
  • Loading branch information
karls committed Jul 18, 2023
1 parent cca5591 commit a3bf95e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions judoscale/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def initialize(cls, env: Mapping = os.environ):
return cls.for_heroku(env)
elif env.get("RENDER_INSTANCE_ID"):
return cls.for_render(env)
elif env.get("ECS_CONTAINER_METADATA_URI_V4"):
elif env.get("ECS_CONTAINER_METADATA_URI"):
return cls.for_ecs(env)
else:
return cls(None, "", env)
Expand All @@ -59,7 +59,7 @@ def for_render(cls, env: Mapping):

@classmethod
def for_ecs(cls, env: Mapping):
instance = env["ECS_CONTAINER_METADATA_URI_V4"].split("/")[-1]
instance = env["ECS_CONTAINER_METADATA_URI"].split("/")[-1]
runtime_container = RuntimeContainer(instance)
api_base_url = env.get("JUDOSCALE_URL")
return cls(runtime_container, api_base_url, env)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_on_render(self):

def test_on_ecs(self):
fake_env = {
"ECS_CONTAINER_METADATA_URI_V4": "http://169.254.170.2/v3/a8880ee042bc4db3ba878dce65b769b6-2750272591", # noqa
"ECS_CONTAINER_METADATA_URI": "http://169.254.170.2/v3/a8880ee042bc4db3ba878dce65b769b6-2750272591", # noqa
"JUDOSCALE_URL": "https://adapter.judoscale.com/api/srv-123",
"LOG_LEVEL": "WARN",
}
Expand Down

0 comments on commit a3bf95e

Please sign in to comment.