Skip to content

Commit

Permalink
Change core application interface, add environment util methods
Browse files Browse the repository at this point in the history
  • Loading branch information
aedart committed May 16, 2024
1 parent 1dd8031 commit 668782b
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions packages/contracts/src/core/Application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
ServiceProviderConstructor
} from "@aedart/contracts/support/services";
import {
DetectEnvironmentCallback,
BootCallback,
TerminationCallback
} from "./types";
Expand All @@ -32,13 +33,58 @@ export default interface Application extends Container
get version(): string;

/**
* The Service Registrar used by this application
* Determine if application is in the local environment
*
* @return {boolean}
*/
isLocal(): boolean;

/**
* Determine if application is in the production environment
*
* @return {boolean}
*/
isProduction(): boolean;

/**
* Determine if application is in a testing environment
*
* @return {boolean}
*/
isTesting(): boolean;

/**
* Determine if application's environment matches either of the given
*
* @param {...string} environment
*
* @return {boolean}
*/
isEnvironment(...environment: string[]): boolean;

/**
* The current application's environment
*
* @type {string}
*/
get environment(): string;

/**
* Detect and return the current application's environment
*
* @param {DetectEnvironmentCallback} [callback] If no callback is given, then a default
* detection callback is used.
*
* @return {string}
*/
detectEnvironment(callback?: DetectEnvironmentCallback): string;

/**
* The Service Registrar used by this application
*
* @type {Registrar}
*/
get registrar(): Registrar;

// TODO: Application Environment ???

/**
* Register a service provider
Expand Down

0 comments on commit 668782b

Please sign in to comment.