The useStatamicRuntimeConfig composable is used to get the Statamic runtime config object from the runtime config.
You can optionally provide an event object to the composable to get the runtime config from that event. This is useful for server side requests.
<script setup lang="ts">
const statamic = useStatamicRuntimeConfig();
</script>
Provide the event object to the composable to get the runtime config from the event.
import type { EventHandlerRequest, H3Event } from "h3";
export default defineCachedEventHandler(async (event: H3Event) => {
const config = useStatamicRuntimeConfig(event);
});
function useStatamicRuntimeConfig(_event?: H3Event<EventHandlerRequest>): Required<ModuleOptions>
If no event is provided, the runtime config will be taken from the global runtime config.
The runtime config object is retrieved from the runtime config using the
useRuntimeConfigcomposable.