type Cosys

type Cosys struct {}

Cosys is the main app, where the core services, module services etc. can be accessed from.

All methods are concurrency safe, unless otherwise stated.

When the Cosys app is run, the Cosys struct undergoes the following procedure.

  1. Registration - Core services, module services etc. are added to the Cosys struct.
  2. Bootstrap - Startup processes before the server is started. The registered bootstrap hooks of each module is run.
  3. Execution - The server is started or the command is run.
  4. Cleanup - Cleanup processes before the app is shutdown. The registered cleanup hooks of each module is run.

func (*Cosys) Environment

func (c *Cosys) Environment() Environment

Returns which environment the app is running in.

func (*Cosys) SetEnvironment

func (c *Cosys) SetEnvironment(env Environment)

Update which environment the app is running in.