Configuration

A short tutorial that demonstrates how to configure your alt-seven application.

alt-seven configuration options tutorial

You configure your alt-seven application by passing an options structure to the a7.init method. There are a host of options that you can tailor to your needs. Below is an example call to a7.init() with all possible options specified. The default value for a given option is bracketed like so [templateLiterals],

var remoteModules = {}; // format specified in Remote section
var options = {
  model: ["altseven"], // defaults to the internal model. Detail in the Model tutorial
  auth: {
    sessionTimeout: 15 * 60 * 1000 // 15 minutes. The built-in remote function calls the refresh URL at this interval
  },
  console: {
    enabled: true,
    wsServer: "ws://example.com/ws"|"", // server-side websocket logger, specified in Console tutorial
    container: ["gadgetui.display.FloatingPane"|""],//if enabled = false, defaults to ""
    top: [100],
    left: [500],
    width: [500],
    height: [300]
  },
  logging: {
    logLevel: ["ERROR,FATAL,INFO"], // all option: "DEBUG,INFO,WARN,FATAL,TRACE"
    toBrowserConsole: true|[false] // passes the log message to the console
  },
  remote: {
    loginURL: "/login", // default: "", remote method should return a json object { success: true|false, user: Object }.
    logoutURL: "/logout",  // default: "", remote method should return a json object { success: true|false }
    refreshURL: "/refresh", // default: "", remote method should return a json object { success: true|false }
    useTokens: [true]|false // useTokens looks for token, format specified in the authentication section
    modules: {} // format specified in Remote section
  },
  router: {
    useEvents: [true]|false, // option calls events when a route is matched. Specified in the Routing tutorial
    routes: [
    	['/auth/showlogin', 'auth.showLogin'] // routes is an array of paths to match. More details in the Routing tutorial
    ]
  },
  ui: {
    renderer: "Handlebars|Mustache|[templateLiterals]", // templating engine. templateLiterals is the internal engine
    debounceTime: 20, // time in ms before a render request of an object can be queued
    timeout: 3600000 // 1 hour , time before a cached view expires
  }
};

a7.init(options);

See the app.js file in the LacesIDE project for a complete way to implement the a7.init(options) method in the context of an application.


Last modified February 2, 2024: additions to docs - WIP (15a6699)