Skip to main content

useEnvironment

Resolves which environment (OTAP) an app screen belongs to, for CnEnvironmentBanner.

import { useEnvironment } from '@conduction/nextcloud-vue'

const { environment } = useEnvironment({ environment: () => props.environment })
ArgumentTypeDescription
options.environment() => unknownGetter for the app's own environment setting. It wins over the organisation.
options.tenantobjectThe tenant context; defaults to the injected one.
options.apiBasestringOpenRegister API base used to read an organisation by uuid. Default /apps/openregister/api.

Return value​

KeyTypeDescription
environmentComputedRef<string>development, test or acceptance; '' for none, production or an unknown value.

The active organisation's environment field is used when the app sets none. It follows a tenant switch. A failed read resolves to '' and logs one warning.