Skip to content

Set environment variables to detect we're inside a Coder workspace #2340

Closed
@mafredri

Description

@mafredri

As a user, I want my generic dotfiles to behave a specific way in Coder workspaces

I'm proposing we set the following environment variables inside workspaces:

CODER_WORKSPACE_NAME=maf/work
CODER_WORKSPACE_TEMPLATE=docker
CODER_WORKSPACE=true

I think the CODER_WORKSPACE_TEMPLATE is optional/nice-to-have for extra customization based on env, but the other two seem kind of like standard practice.

Example from Codespaces:

CODESPACE_NAME=mafredri-myrepo-a3rj5r302v9
CODESPACES=true

This can be done even today by detecting CODER_AGENT_* variables, but I consider this "internal logic" that the user can't rely on.

Metadata

Metadata

Assignees

No one assigned

    Labels

    apiArea: HTTP APIcliArea: CLI

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions