import os

from django import template

from servala.__about__ import __version__

register = template.Library()


@register.simple_tag
def get_version_or_env():
    """Return version number in production, environment name otherwise."""
    env = os.environ.get("SERVALA_ENVIRONMENT", "development")
    if env == "production":
        return __version__
    return env  # pragma: no cover
