# -----------------------------------------------------------------------------
# Project: OpenGTS - Open GPS Tracking System
# URL    : http://www.opengts.org
# File   : common.conf
# -----------------------------------------------------------------------------
# Notes:
#   - This runtime-config file establishes global system-level attributes 
#     (the 'private.xml' file establishes domain-level atributes).
#   - Comment lines begin with a '#' character.
#   - Comments MUST NOT be placed at the end of a key=value line
#   - Variable name substitution syntax defined in 'README.txt'
# -----------------------------------------------------------------------------
# This config file includes the following files, this this order:
#   - system.conf
#   - statusCodes.conf
#   - custom.conf
#   - custom_gts.conf
#   - config_old.conf
#   - config.conf
# -----------------------------------------------------------------------------

# -----------------------------------------------------------------------------
# --- Debug
# --- (used for debugging purposes only)
#%debugMode=true

# -----------------------------------------------------------------------------
# --- Logging
# --- (output message logging specifications)
#%log=${%version} IsWebApp=${%isWebApp}

# - log location
log.dir=${GTS_HOME=/tmp}/logs

# - log file context
# (the default 'contextName' is obtained from the main class or servlet context)
%if %isWebApp == true
    #%log Default context name: "webapp"
    log.name=${%contextName=webapp}
    # - enable internal file logging
    log.file.enable=true
    # - default log-level
    #log.level=debug
    log.level=info
%else
    #%log Default context name: "default"
    log.name=${%contextName=default}
    # - disable internal file logging
    log.file.enable=false
    # - default log-level
    log.level=info
%endif

# - log file name
log.file=${log.dir}/${log.name}.log

# - automatically rotate log file when specified size is reached
log.file.rotate.maxSize=5000000

# - date format extension appended to rotated log files
# (see JDK JavaDocs for 'SimpleDateFormat' for formatting options)
# -   yyyy = year
# -   MM   = month
# -   dd   = day
# -   HH   = hour
# -   mm   = minute
# -   ss   = seconds
# -   SSS  = milliseconds
#log.file.rotate.dateFormatExtn=yyyyMMddHHmmss.SSS'.log'
log.file.rotate.dateFormatExtn=yyyyMMddHHmmss'.log'

# - delete rotated log files greater than specified age (s=seconds, m=minutes, d=days)
# (ie. defaults to 'days'.  ie "60" is 60 days, "60m" is 60 minutes)
#log.file.rotate.deleteAge=60d

# - log header level 
# (display header/date/frame on log msgs with 'log.level.header' or higher)
log.level.header=all

# - include date and stackframe on log messages
log.include.date=true
log.include.frame=true

# --- display log message
#%log=(${log.name}:${%version}) Loading "${%configURL}"
#%log=Context Name : "${%contextName}"
#%log=Context Path : "${%contextPath}"

# -----------------------------------------------------------------------------

# --- StartupInit
# (this should point to your customized StartupInit module, if any)
#StartupInit.class=org.opengts.StartupInit

# -----------------------------------------------------------------------------

# --- EventData
#EventData.defaultPushpinName=heading

# -----------------------------------------------------------------------------

# --- Database access config
# --- (these values must match the authorized SQL database access provided by the system admin)
# --  General property descriptions:
# --   - db.sql.provider
# --       The name of the database provider supported by the GTS (ie. "mysql", "sqlserver")
# --   - db.sql.host
# --       The name of the host where the database server resides (ie. "localhost")
# --   - db.sql.port
# --       The port on the database server host where the database provider listens for requests.
# --   - db.sql.dbname
# --       The name of the GTS database (ie. "gts")
# --   - db.sql.user
# --       The name of the user with authorized access to the GTS database (ie. "gts")
# --   - db.sql.password
# --       The password for the GTS database user (ie. "opengts")
# --   - db.sql.url
# --       The base JDBC connection url for the database access
# --   - db.sql.url.db 
# --       The full JDBC connection url for the database access
db.provider=mysql

# --- MySQL
%if db.provider == mysql
    db.sql.provider=${ServiceAccount.db.provider=mysql}
    db.sql.host=localhost
    db.sql.port=3306
    db.sql.dbname=${ServiceAccount.db.name=gts}
    db.sql.user=${ServiceAccount.db.user=gts}
    db.sql.password=${ServiceAccount.db.pass=opengts}
    #db.sql.rootUser=root
    #db.sql.rootPass=rootpass
    db.sql.utf8=${ServiceAccount.db.utf8=true}
    db.sql.url=jdbc:mysql://${db.sql.host}:${db.sql.port}/
    #db.sql.url.db=${db.sql.url}${db.sql.dbname}
    db.sql.url.db=${db.sql.url}${db.sql.dbname}?characterEncoding=UTF-8&useUnicode=true&characterSetResults=utf8
    # Other possible MySQL JDBC options include:
    #   &interactiveClient=true
    #   &tcpKeepAlive=true
    #   &autoReconnect=true
    #   &paranoid=true
    #   &characterEncoding=UTF-8
    #   &useUnicode=true
    #   &characterSetResults=utf8
    #   &jdbcCompliantTruncation=false  (to truncate data to the size of the field)
    #db.mysql.tableExistsSelectCount=true
%endif

# --- Microsoft SQL Server
%if db.provider == sqlserver
    db.sql.provider=sqlserver
    db.sql.host=localhost
    #db.sql.port=3193
    db.sql.port=1433
    db.sql.dbname=gts
    db.sql.user=gts
    db.sql.password=opengts
    db.sql.url=jdbc:sqlserver://${db.sql.host}:${db.sql.port}
    db.sql.url.db=${db.sql.url};databaseName=${db.sql.dbname};user=${db.sql.user};password=${db.sql.password}
%endif

# --- PostgreSQL (may not be fully supported)
%if db.provider == postgresql
    db.sql.provider=postgresql
    db.sql.dbname=gts
    db.sql.host=localhost
    db.sql.port=5432
    db.sql.user=gts
    db.sql.password=opengts
    db.sql.url=jdbc:postgresql://localhost:${db.sql.port}/
%endif

# --- Apache Derby (NOT FULLY SUPPORTED)
%if db.provider == derby
    db.sql.provider=derby
    db.sql.host=localhost
    db.sql.port=1527
    db.sql.dbname=gts
    db.sql.user=gts
    db.sql.password=opengts
    db.sql.url=jdbc:derby://${db.sql.host}:${db.sql.port}/${db.sql.dbname};create=true
    db.sql.url.db=${db.sql.url}
%endif

# -----------------------------------------------------------------------------

# --- Show sql statements prior to execution, show new connections (for debug purposes)
#db.showSQL=true
db.showConnections=false

# --- DBConnection pool
#db.dbConnectionPool=true

# --- DataSource connection pool
#db.dataSource.class=default
#db.dataSource.maxActive=100
#db.dataSource.maxIdle=30
#db.dataSource.maxWait=10000

# -----------------------------------------------------------------------------

# --- Device authorization when no groups have been assigned
# - (ie. if no explicit group is assigned to a user, does the user have access to all devices?)
#db.defaultDeviceAuthorization=true
#db.defaultDeviceAuthorization.smith=false

# --- Transport/UniquwXID uniqueID lookup
Transport.queryEnabled=true
UniquwXID.queryEnabled=false

# -----------------------------------------------------------------------------

# --- SMS default enabled state [false|true|account]
Account.smsEnabled=true

# -----------------------------------------------------------------------------

# --- Past event timestamp handling
# - (Note: usage of this feature necessitates always having an accurate system clock time)
# - Action to take when an event contains a date in the past. [ignore|truncate|disabled]
# -   ignore   : Ignore records which are more than 'maximumSec' seconds into the past.
# -   truncate : Sets the maximum 'past' date to the current time.
# -   disabled : Past dates are not checked (ie. they are passed through as-is).
Device.pastDate.action=disabled

# - Maximum number of seconds into the past that a reported event is allowed to have.
# - Must be > 0 to be enabled.  Past dates less than the current timestamp, minus this
# - offset will be ignored, or trucnated to the current time.  (31536000 sec = 365 days)
Device.pastDate.maximumSec=31536000

# --- Future event date handling
# - (Note: usage of this feature necessitates always having an accurate system clock time)
# - Action to take when an event contains a date in the future. [ignore|truncate|disabled]
# -   ignore   : Ignore records which are more than 'maximumSec' seconds into the future.
# -   truncate : Sets the maximum 'future' date to the current time.
# -   disabled : Future dates are not checked (ie. they are passed through as-is).
Device.futureDate.action=disabled

# - Maximum number of seconds into the future that a reported event is allowed to have.
# - Must be > 0 to be enabled.  Future dates greater than the current timestamp, plus this
# - offset will be ignored, or trucnated to the current time.  (86400 sec = 1 day)
Device.futureDate.maximumSec=86400

# -----------------------------------------------------------------------------

# --- SMTP
# --- (outgoing email configuration parameters)
##smtp.host=localhost
#smtp.debug=false
#smtp.host=smtp.example.com
#smtp.port=465
#smtp.user=someusername
#smtp.user.emailAddress=someusername@example.com
#smtp.password=password
#smtp.enableSSL=true
#smtp.enableTLS=true
#smtp.threadModel.show=false

# -----------------------------------------------------------------------------

# --- System Admin account name
sysAdmin.account=sysadmin

# --- Account: default PrivateLabel name for new accounts
#Account.default.privateLabelName=*

# --- HTTP User-Agent (used by "HTMLTools.java")
# - (should always be resolved in the conext of a PrivateLabel)
http.userAgent=OpenGTS/${%version} [${session.locale=EN}] ${session.name=}

# -----------------------------------------------------------------------------

# --- PasswordHandler [default|md5|<className>]
#PasswordHandler.class=<include a PasswordHandler implementation subclass here>
#PasswordHandler.class=md5

# -----------------------------------------------------------------------------

# --- SmsGatewayHandler (see DCServerConfig.java, SMSOutboundGateway.java)
# -
# - default outbound SMS gateway name
#SmsGatewayHandler.gatewayName=httpURL
# -
# - EMail-based SMS gateway
#SmsGatewayHandler.emailBody.smsEmailAddress=%{mobile}@sms.example.com
#SmsGatewayHandler.emailSubject.smsEmailAddress=%{mobile}@sms.example.com
# -
# - Generic HTTP-based SMS gateway (ie. Kannel)
#SmsGatewayHandler.httpURL.url=http://localhost:12345/sendSMS?user=myuser&pass=mypass&from=%{sender}&to=%{mobile}&text=%{message}
# -
# - MultiTech SF100-G HTTP-based SMS gateway
#SmsGatewayHandler.httpURL.url=http://localhost:9191/sendmsg?user=admin&passwd=admin&cat=1&to=%{mobile}&text=%{message}
# -
# - Clickatel
#SmsGatewayHandler.clickatell.smsEmailAddress=@sms.example.com
#SmsGatewayHandler.clickatell.user=myuser
#SmsGatewayHandler.clickatell.password=mypass
#SmsGatewayHandler.clickatell.api_id=1234
# -
# - TextAnywhere
#SmsGatewayHandler.mail2txt.smsEmailAddress=@sms.example.com
#SmsGatewayHandler.mail2txt160.smsEmailAddress=@sms.example.com
#SmsGatewayHandler.mail2txtid.smsEmailAddress=@sms.example.com
#SmsGatewayHandler.mail2txtid.from=me@example.com
#SmsGatewayHandler.mail2txt160id.smsEmailAddress=@sms.example.com
#SmsGatewayHandler.mail2txt160id.from=me@example.com
# -

# -----------------------------------------------------------------------------

# --- Custom RuleFactory
#RuleFactory.class=<include a RuleFactory implementation subclass here>

# --- RuleFactoryLite
#RuleFactory.class=org.opengts.extra.rule.RuleFactoryLite
#RuleFactoryLite.emailEnabled=true

# --- Custom Rule functions/identifiers
#EventFunctionMap.adminAccounts=cronadmin
#EventFunctionMapFactory.class=rule.ExampleFunctionMapFactory
#EventIdentifierMapFactory.class=rule.ExampleIdentifierMapFactory

# --- custom RuleListener (replace with your own custom RuleListener)
#rule.ruleListenerClass=org.opengts.rule.RuleListenerTest

# --- Rule WorkHours (feature may not be available in all releases)
rule.workHours.sun=
rule.workHours.mon=06:00-18:00
rule.workHours.tue=06:00-18:00
rule.workHours.wed=06:00-18:00
rule.workHours.thu=06:00-18:00
rule.workHours.fri=06:00-18:00
rule.workHours.sat=

# -----------------------------------------------------------------------------

# --- BorderCrossing SubdivisionProvider
#SubdivisionProvider.class=

# --- BorderCrossing PostgreSQL
#bc.sql.host=localhost
#bc.sql.port=
bc.sql.dbname=bcrossing_db
bc.sql.user=bcross
bc.sql.password=
bc.sql.tables=bc_boundaries

# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# --- Include other runtime conf files

# --- Service Account values (autogenerated config file)
%include?=file:system.conf
%include?=file:authkeys.conf

# --- Status code overrides
%include?=file:statusCodes.conf

# --- Extra custom initialization on startup
%include?=file:custom.conf
%include?=file:custom_gts.conf

# --- gtsConfig value overrides
# - 'config_old.conf' is loaded to set the defaults for 'config.conf'
# - 'config.conf' is modified by "bin/gtsConfig.pl -config"
# - The file 'config_old.conf' is no longer needed once 'config.conf' is modified/merged
# - The following command will merge "config_old.conf" into "config.conf"
# -   bin/exeJava org.opengts.util.RTConfig -merge=config_old.conf -into=config.conf
%include?=file:config_old.conf
%include?=file:config.conf

# ---
