Member Junction
    Preparing search index...

    Configuration manager singleton for handling MJ configuration

    Stores the original working directory and MJ configuration to ensure consistent access across all commands, even when the current working directory changes during execution.

    Hierarchy (View Summary)

    Index

    Constructors

    Accessors

    Methods

    • The Global Object Store is a place to store global objects that need to be shared across the application. Depending on the execution environment, this could be the window object in a browser, or the global object in a node environment, or something else in other contexts. The key here is that in some cases static variables are not truly shared because it is possible that a given class might have copies of its code in multiple paths in a deployed application. This approach ensures that no matter how many code copies might exist, there is only one instance of the object in question by using the Global Object Store.

      Returns GlobalObjectStore

    • Load MemberJunction configuration.

      Resolution order:

      1. process.env.MJ_CONFIG_FILE — if set to an absolute or repo-relative path of a config file (e.g. mj.config.cjs), load that file directly. Used by the regression archive flow to swap configs between mj sync pull (source DB) and mj sync push (archive DB) without touching the filesystem.
      2. Otherwise: cosmiconfig search starting from the original working directory, walking up. This is the original behavior.

      The loaded user config is merged into DEFAULT_SYNC_CONFIG so env-var overrides for database settings continue to apply.

      Result is cached for subsequent calls; pass forceReload=true to invalidate.

      Parameters

      • forceReload: boolean = false

      Returns MJConfig

    • Returns the singleton instance of the class. If the instance does not exist, it is created and stored in the Global Object Store. If className is provided it will be used as part of the key in the Global Object Store, otherwise the actual class name will be used. NOTE: the class name used by default is the lowest level of the object hierarchy, so if you have a class that extends another class, the lowest level class name will be used.

      Type Parameters

      Parameters

      • this: new () => T
      • OptionalclassName: string

      Returns T