Skip to content

docker-entrypoint.sh: allow OSC_ENVIRONMENT override #247

Description

@birme

Problem

The `docker-entrypoint.sh` always derives `OSC_ENVIRONMENT` from `OSC_HOSTNAME` with no way to override it:

```sh
OSC_ENVIRONMENT=$(echo "$OSC_HOSTNAME" | sed 's/.auto.(.).osaas.io/\1/')
export OSC_ENVIRONMENT
```

Instances running on Elastx (`prod-se`) extract `OSC_ENVIRONMENT=prod-se`, which causes the `/api/v1/reauth` endpoint to call `token.svc.prod-se.osaas.io` instead of `token.svc.prod.osaas.io`. If the tenant's subscription is not synced to the prod-se token service, reauth returns 500 after 3 failed attempts (403 from the token service).

Fix

Respect a preset `OSC_ENVIRONMENT` env var — only derive it from the hostname if it is not already set:

```sh
if [ -z "$OSC_ENVIRONMENT" ]; then
OSC_ENVIRONMENT=$(echo "$OSC_HOSTNAME" | sed 's/.auto.(.).osaas.io/\1/')
export OSC_ENVIRONMENT
fi
```

This allows operators to inject `OSC_ENVIRONMENT=prod` via the deployment spec as a workaround until entitlements are synced to prod-se.

Context

Discovered during Elastx migration: tenant `svt4w` instances (`svt4w-svt4wire`, `svt4w-beta`, `svt4w-bjorn`) on prod-se were hitting 500 on reauth. Workaround applied by overriding the container command in the deployments to bypass the entrypoint and force `OSC_ENVIRONMENT=prod`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions