#
# This file contains Your MToken configuration directives.
#
# NOTE!!
# All directives MUST BE written in Apache-config style!
# See https://metacpan.org/pod/Config::General#-ApacheCompatible
#

Include conf.d/*.conf

#
# Store section
#
# Section for connection with Your database. Recommended for use follow databases:
# SQLite (local, default), MySQL, PostgreSQL (pg) or Oracle
#

# SQLite example:
#<Store>
#    File       /tmp/test.db
#    Attributes RaiseError=0; PrintError=0; sqlite_unicode=1
#</Store>

# MySQL example:
#<Store>
#    DSN        DBI:mysql:database=mtoken;host=mysql.example.com
#    User       username
#    Password   password
#    Timeout    10
#    Attributes RaiseError=0; PrintError=0; mysql_enable_utf8=1; mysql_auto_reconnect=1
#</Store>

# PostgreSQL Example
#<Store>
#    DSN        DBI:Pg:dbname=mtoken;host=mysql.example.com
#    User       username
#    Password   password
#    Timeout    10
#    Attributes RaiseError=0; PrintError=0; pg_enable_utf8=1
#</Store>

# Oracle Example
#<Store>
#    DSN        DBI:Oracle:MYSID
#    User       username
#    Password   password
#    Timeout    10
#    Attributes RaiseError=0; PrintError=0
#</Store>

#
# Client configuration
#

#
# Maximum number of redirects the user agent will follow before it fails
#
#MaxRedirects	10

#
# Maximum amount of time in seconds establishing a connection may take
# before getting canceled
#
#ConnectTimeout	10

#
# Maximum amount of time in seconds a connection can be inactive before getting closed,
#
#InactivityTimeout	30

#
# Maximum amount of time in seconds establishing a connection, sending the request
# and receiving a whole response may take before getting canceled
#
#RequestTimeout     180


#
# Server configuration
#

#
# The location to listen on, defaults to *:8642 (shortcut for http://0.0.0.0:8642).
# See also "listen" in Mojo::Server::Daemon for more examples.
#
#Listen *:8642

#
# The separated listen address. Default to * (0.0.0.0)
#
#ListenAddr *

#
# The separated listen port. Default to 8642
#
#ListenPort 8642

#
# Maximum number of connections a worker is allowed to accept, before
# stopping gracefully and then getting replaced with a newly started worker,
# defaults to the value of "accepts" in Mojo::Server::Prefork.
# Setting the value to 0 will allow workers to accept new connections
# indefinitely.
#
#Accepts 0

#
# Maximum number of accepted connections each worker process is allowed to
# handle concurrently, before stopping to accept new incoming connections,
# defaults to 100. Note that high concurrency works best with applications
# that perform mostly non-blocking operations, to optimize for blocking
# operations you can decrease this value and increase "workers" instead
# for better performance.
#
#Clients 1000

#
# Maximum number of keep-alive requests per connection, defaults to 100.
#
#Requests 100

#
# Temporarily spawn up to this number of additional workers if there
# is a need, defaults to 2. This allows for new workers to be started while
# old ones are still shutting down gracefully, drastically reducing the
# performance cost of worker restarts.
#
#Spare 2

#
# Number of worker processes, defaults to 4. A good rule of thumb is two
# worker processes per CPU core for applications that perform mostly
# non-blocking operations, blocking operations often require more and
# benefit from decreasing concurrency with "clients" (often as low as 1).
#
#Workers 4

#
# Document root directory
#
#DocumentRoot /usr/share/mtoken

#
# SSL/TLS
#
# To regenerate all required certificates run these commands (07.10.2021)
#
# CA key & CA certificate files (password=password):
#
# openssl req -new -newkey rsa:2048 -keyout ca.key -x509 -days 7300 \
#  -subj "/C=ME/ST=Cetinje/L=Cetinje/O=D&D Corporation/OU=www.suffit.org/CN=Suffit CA Certificate/emailAddress=abalama@cpan.org" \
#  -out ca.crt
#
# openssl genrsa -out server.key 2048
# openssl req -new -key server.key -out server.csr \
#  -subj "/C=ME/ST=Cetinje/L=Cetinje/O=D&D Corporation/OU=MToken/CN=localhost/emailAddress=root@localhost"
# openssl x509 -req -days 3650 -in server.csr -out server.crt -CA ca.crt \
#  -CAkey ca.key -CAcreateserial
#
# Verifications:
#
# openssl req -noout -text -in server.csr
# openssl x509 -noout -text -in server.crt
# openssl rsa -noout -text -in server.key
# openssl rsa -noout -modulus -in server.key | openssl md5
# openssl x509 -noout -modulus -in server.crt | openssl md5
#

#
# Enables or disables the TLS (https) listening, default to disabled
#
#TLS            enabled

#
# Paths to TLS files. Absolute or relative paths (started from /etc/mtoken)
#
# TLS_CA - Path to TLS certificate authority file used to verify the peer certificate.
# TLS_Cert - Path to the TLS cert file, defaults to a built-in test certificate.
# TLS_Key - Path to the TLS key file, defaults to a built-in test key.
#
#TLS_CA         certs/ca.crt
#TLS_Cert       certs/server.crt
#TLS_Key        certs/server.key

#
# TLS extra data
#
# TLS cipher specification string. For more information about the format see
# https://www.openssl.org/docs/manmaster/man1/ciphers.html#CIPHER-STRINGS.
# TLS_Verify - TLS verification mode.
# TLS_Version - TLS protocol version.
#
#TLS_Ciphers    AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH
#TLS_Verify     0x00
#TLS_Version    TLSv1_2

#
# Authentication credentials for private documents only
#
#Username admin

# SHA1 hash of real password: admin (default)
# To generate hashes try use command (unsecure): echo -n admin | sha1sum
#Password d033e22ae348aeb5660fc2140aec35850c4da997
