The AOC Framework
github logodiscord logo

GETTING STARTED

Client Configuration #

The client configuration is defined by the AocAppConfig class. Within the client folder, in /src/environments, you will find two files:

  • environment.prod.ts: used when compiling the application for production
  • environment.ts: used when running the application during development

Both files will contain an object named Config. Make sure to adapt the configurations to your needs.

Here is a sample config.sample.ts of what a configuration would look like:

import { AocAppConfig } from '@atlantis-of-code/aoc-client/core/configs';

const Config = new AocAppConfig();

Config.APP_ID = 'aoc_app'; // ID of the AOC application.
Config.PROGRAM_NAME = 'Program name'; // Name of the program.
Config.SERVER_URL = 'http://localhost:3000/'; // URL of the server.
Config.BASE_HREF = ''; // Base href.
Config.MULTI_TENANCY = false; // Indicates if the application supports multi-tenancy.
Config.TAB_DEFAULT_MENU_ITEMS = ['/dashboard']; // Tabs that will be opening at start.
Config.TAB_IGNORE_ROUTES = []; // Routes that will be ignored by the tab service.
Config.DISABLE_COMPONENT_CACHE_FOR_ROUTES = []; // Tabs (or routes) that won't be cached/reused.
Config.DO_NOT_SHOW_AOC_FAVICON_IN_DEVMODE = false; // Optional, by default AOC favicon is shown in dev mode to help identify dev browser tab.
Config.BYPASS_LOGIN_CHECK = false; // Optional, true in case we would like to bypass the login check.
Config.LOGGER = {
  level: 'DEBUG', // Logger level.
  remote: {
    level: 'DEBUG', // Remote logger level.
    responseType: 'text', // Optional, response type of the remote logger.
    url: 'http://127.0.0.1:3003/log' // URL of the remote logger.
  },
  sourceMaps: true, // Source maps for the logger.
  timestampFormat: 'yyyy-MM-dd HH:mm:ss.SSS XX' // Optional, timestamp format for the logger.
};
Config.PDFJS_URL = '/pdfjs/web/viewer.html'; // URL of the PDFJS viewer used in mobile.

export { Config };
Property Description
APP_ID ID of the AOC application.
PROGRAM_NAME Name of the program.
SERVER_URL URL of the server.
BASE_HREF Base href.
MULTI_TENANCY Indicates if the application supports multi-tenancy.
TAB_DEFAULT_MENU_ITEMS Tabs that will be opening at start.
TAB_IGNORE_ROUTES Routes that will be ignored by the tab service.
DISABLE_COMPONENT_CACHE_FOR_ROUTES Tabs (or routes) that won't be cached/reused.
DO_NOT_SHOW_AOC_FAVICON_IN_DEVMODE Optional, by default AOC favicon is shown in dev mode to help identify dev browser tab.
BYPASS_LOGIN_CHECK Optional, true in case we would like to bypass the login check.
LOGGER Logger configuration.
LOGGER.level Logger level.
LOGGER.remote Remote logger configuration.
LOGGER.remote.level Remote logger level.
LOGGER.remote.responseType Response type of the remote logger.
LOGGER.remote.url URL of the remote logger.
LOGGER.sourceMaps Source maps for the logger.
LOGGER.timestampFormat Timestamp format for the logger.
PDFJS_URL URL of the PDFJS viewer used in mobile.

Advanced Configuration #

If needed, you can define additional configurations; here are some examples:

  • environment.john.ts: used by the user John on his computer while developing
  • environment.testing-server.ts: used when deploying the application on a testing server

You need to modify the angular.json file to reflect the file replacements:

...
"build": {
  "configurations": {
    "john": {
      "fileReplacements": [
        {
          "replace": "src/environments/environment.ts",
          "with": "src/environments/environment.john.ts"
        }
      ]
    }
  }
},
"serve": {
  "configurations": {
    "john": {
      "browserTarget": "my-app:build:development,john",
      "proxyConfig": "src/proxy.conf.js" // (in case you need it)
    }
  }
}
...

When starting the client in development mode, you can add the configuration to the command line: npm start -- --configuration=john, this argument will be passed to ng-cli. You can use this same strategy for production builds if necessary.

Please note, browse Issues and Discussions in Github for more information

© 2024 Atlantis of Code. All rights reserved.
All trademarks are the property of their respective owners.