Re-jig config accessors

We only ever used the static instance() method to get to the config
object, so just make a static instance that returns the ConfigOptions
directly, throwing an exception if it's not yet initialised. This way
the types can all be non-optional (plus it's shorter).
This commit is contained in:
David Baker 2022-12-21 10:17:53 +00:00
commit c879090a34
4 changed files with 19 additions and 20 deletions

View file

@ -114,8 +114,8 @@ export class PosthogAnalytics {
constructor(private readonly posthog: PostHog) {
const posthogConfig: PosthogSettings = {
project_api_key: Config.instance.config.posthog?.api_key,
api_host: Config.instance.config.posthog?.api_host,
project_api_key: Config.get().posthog?.api_key,
api_host: Config.get().posthog?.api_host,
};
if (posthogConfig.project_api_key && posthogConfig.api_host) {