There are three files involved in the system configuration for Track and Trace 2:
The following chapter describes theese configuration files in detail.
The directory /config contains several configuration files named [site]_tntconfig.js, one for each site. To determine which one to use a symlink is created that is called tntconfig.js pointing at the chosen site configuration file.
The configuration file exports one single JSON object which is the configuration for all the server backend modules.
Configuration for the behaviour of the app synchronization.
app: { syncallitems:false }
Configuration for the behaviour of the client backend.
client: { modules: { accounts: true, reports:true } }
Database configuration.
db: { connectionstring: "mongodb://localhost:27017/tnt_test", user: "admin", pass: "admin" }
Error management configuration.
errorhandling: { logconsole: true, logfile: "/tmp/tntErrorLog.log", logcollection: "errors", email: { default: ["user1@domain.sample", "user2@domain.sample"] } }
Integration module configuration for outgoing integrations.
integration: { active: true, modules: [ { active: true, name: "Testintegration module", qprefix: "int.test.", src: "test/test.js", config: {} } ], schedule: "10 */2 * * * *" }
Configuration for data import modules readin data from source systems into TnT2.
import: { mappings: [ {system: "SIB"} ], storerooms: [ {system: "SIB"} ], users: [ {system: "SIB"} ] }
Logger configuration
logger: { active:{ console: true, file: true, mqtt: false }, path: "/opt/node/TrackAndTrace2/logs/", topic: "test/log" }
MQTT configuration, this part is currently not implemented
mqtt: { enabled: false, host: "mqtt://192.168.126.129", prefix: "DEV/TNT2/" }
Configuration of the creation of packs on manifest building.
packs: { skipTypes: ["04", "05", "06", "07", "08", "09"] }
Permission configuration telling the system what permissions the different user roles will have.
permissions: { default: 1, 0: {client_lvl:0,description: "-",modules: {}}, 1: {client_lvl: 0,description: "Shotfirer",modules: {doreturn:true, move:true, menu:{lang:false, store:false}}}, 2: {client_lvl: 3,description: "Explosives responsible",modules: {doreturn: true,move: true,receipt: true,inventory: true,pack_add: true,pack_handover: true,pack_remove: true, menu:{lang:false, store:false}}}, 3: {client_lvl: 0,description: "Storage personel",modules: {move: true,receipt: true,inventory: true, menu:{lang:false, store:false}}}, 4: {client_lvl: 0,description: "Contractor",modules: {doreturn: true, menu:{lang:false, store:false}}}, 9: {client_lvl: 9,description: "Admin",modules: {doreturn: true,move: true,receipt: true,inventory: false,pack_add: true,pack_issue:true,pack_handover: true,stockcheck:true,pack_remove: true, menu:{lang:true, store:true}}} }
Configuration of which sites to show when sending an exported manifest to another TnT2 system.
recipientsites: [ { name: "Test Recipient", Receiver: { Name:"Test Recipient Name", Name2: "Test Recipient Name2", City:"Test Recipient City" }, cfg:{ type:"ftp", host:"ftp.mysite.com", port:21, user:"ftpuser", pass:"ftppass", path:"/sendTest" } }, ]
Configuration of which report modules to show in the web client. The reports is an array of Objects describing each report module.
reports: [ { id:"tarHrsInStore", description:"Hours in storage", icon:"tar/hrsinstore/gfx/icon.png", server:"tar/hrsinstore/report.js", client:"tar/hrsinstore/report.js" }, { id:"usageStats", description: "Usage report", icon:"_/usage/gfx/icon.png", server:"_/usage/report.js", client:"_/usage/report.js" } ]
The full list of implemented reports at the moment:
{id:"tarHrsInStore", description:"Hours in storage", icon:"tar/hrsinstore/gfx/icon.png", server:"tar/hrsinstore/report.js", client:"tar/hrsinstore/report.js" }, {id:"usageStats", description: "Usage report", icon:"_/usage/gfx/icon.png", server:"_/usage/report.js", client:"_/usage/report.js"}, {id:"itemnumUsage", description:"Usage per ITEMNUM", icon:"_/itemnumusage/gfx/icon.png", server:"_/itemnumusage/reportsrv.js", client:"_/itemnumusage/report.js"}, {id:"siteStockCount", description:"Stock on site", icon:"_/sitestockcount/gfx/icon.png", server:"_/sitestockcount/reportsrv.js", client:"_/sitestockcount/report.js"}, {id:"stockCountMX", description: "Stock counts Maximo / TnT2", icon:"_/stockcountmx/gfx/icon.png", server:"_/stockcountmx/report.js", client:"_/stockcountmx/report.js"}, {id:"transactionReport", description:"Transactions", icon:"tar/transactionreport/gfx/icon.png", server:"tar/transactionreport/reportsrv.js", client:"tar/transactionreport/report.js"}
Configuration for the REST service providing data to the user components of the system.
rest: { port: 4912, modules: [ {desc: "GUI Frontend", file:"gui/gui.js", active: true}, {desc: "Scanner service", file:"scanner/scanner.js", active:true} ] }
Specifying which site this installation is for.
SITE: "TEST"
The standard storeroom to import and receive shipments to if none is specified in the purchase order
STDSTORE: "MyStore"
The configuration for the worker service doing grunt work in the background.
worker: { modules: { detonate: "detonate", detonatebulk: "detonatebulk", handover: "package", inventory: "inventory", manifest: "manifest", move: "mover", movebulk: "movebulk", pack_add: "package", pack_issue: "package", pack_remove: "package", return: "return", returnbulk: "returnbulk", use: "use", usebulk: "usebulk" }, services: { packcheck: { description: "Check for empty packages", module: "packcheck", schedule: "0,30 * * * *" }, reruntransactions: { description: "Rerun failed transactions", maxcount: 48, module: "reruntransactions", schedule: "15 * * * *" } } }
The configuration for the web client is in the /client/index.html file and is simply a matter of setting the correct RESTURL identifying the backend REST Service to the global variable in the script.
var RESTURLs = { DEV: "http://192.168.99.2:4912/", TEST: "http://192.168.126.130:4912/" }; RESTURL = RESTURLs.TEST;
There are a couple of preconfigured URLs to choose from and for future maintainability new sites will be added to the RESTURLs object.
The configurations for the scanner app is in the script file /apps/scanner/config/config.js which defines a config_presets global variable to the scanner app. Theese presets are presented to the user of the scanner at the first startup and the user will choose which configuration preset the scanner will use in the future.
var config_presets = { test: { RESTURI: "http://192.168.126.130:4912/scn/", site: "TestSite", defaultStore: "TestStore", doOnlineSync: true, logoutAfter: 45*60*1000, receiptRequireManifest: true, syncInterval: 30*60*1000 } }