### JDBC connection DataSource provider
# Any properties under cyclos.datasource.* (except cyclos.datasource.provider) is passed to the actual provider.

## Hikari 
## For available configuration options, see https://github.com/brettwooldridge/HikariCP#gear-configuration-knobs-baby
cyclos.datasource.provider = hikari
cyclos.datasource.dataSourceClassName = org.postgresql.ds.PGSimpleDataSource
cyclos.datasource.dataSource.portNumber = 5432
cyclos.datasource.dataSource.serverName = ${DB_HOST}
cyclos.datasource.dataSource.databaseName = ${DB_NAME}
cyclos.datasource.dataSource.user = ${DB_USER}
cyclos.datasource.dataSource.password = ${DB_PASSWORD}
# The default value is 'auto', which resolves to: max(8, min(150, maxRecurringTasks + maxBackgroundTasks + number_of_cpu_cores)).
# When 'auto' (without single quotes) is set, it returns a value between [8, 150].
cyclos.datasource.maximumPoolSize = auto

## When a PostgreSQL hot standby server is used, the master server can be offloaded by directing
## read-only queries to the hot standby server. For this, you can configure the same properties above,
## but using the cyclos.datasource.readOnly prefix. Example:
# cyclos.datasource.readOnly.dataSource.serverName = replica-server
# cyclos.datasource.readOnly.dataSource.portNumber = 55432

### JPA provider (EclipseLink) properties
# We require a custom platform definition, or BLOBs won't work with EclipseLink's default settings
eclipselink.target-database = org.cyclos.bootstrap.CyclosPostgreSQLPlatform
# Integrate EclipseLink logging in our logging structure
eclipselink.logging.logger = org.cyclos.bootstrap.EclipseLinkSLF4JLogger
## Log SQL queries and bind parameters
# eclipselink.logging.level.sql = FINE
# eclipselink.logging.parameters = true

### Database management (automatic creation and upgrade)
# Set cyclos.db.managed to true (the default) for automatic schema creation, database 
# population and upgrades. False will only validate the database version at startup
cyclos.db.managed = true

### Search handler
# By default, searches which use keywords and geodistance are performed on database.
# However, on large systems, the performance can be poor, and the search can be performed on OpenSearch
## Perform searches on database 
cyclos.searchHandler = db
## Perform searches on OpenSearch
# cyclos.searchHandler = opensearch
## Comma-separated list of host specifications: protocol://host:port   
# cyclos.searchHandler.host = http://localhost:9200
## Path prefix within the host(s) for the web service endpoint
# cyclos.searchHandler.pathPrefix = /
## How many shards the indexes should be split in
# cyclos.searchHandler.shards = 1
## How many replicas per shard
# cyclos.searchHandler.replicas = 1
## (Optional) user for a HTTP BASIC authentication with the server   
# cyclos.searchHandler.user = user
## (Optional) password for a HTTP BASIC authentication with the server   
# cyclos.searchHandler.password = password
## When using HTTPS to communicate with the OpenSearch server, should trust all certificates?
# cyclos.searchHandler.trustAllCertificates = false

### Cluster / instance configuration
# Determines the cluster implementation to use. Can be one of the following: 
# * none: No cluster, just a local installation (default)
# * hazelcast: Uses Hazelcast for cluster-related operations
# * <fully-qualified name of a Java class> A custom class implementing org.cyclos.impl.utils.cluster.ClusterHandler
cyclos.clusterHandler = none

### Content manager configuration
## Any properties under cyclos.storedFileContentManager.* (except cyclos.storedFileContentManager) are passed to the implementation

## You can define additional directories (buckets in case of AWS / GCS) to be later on set in Cyclos
## for specific binary custom fields or individual documents. When used, those are to define a different set of permissions
## in the directory itself. When not defined, all files will be stored in the same directory / bucket.
## The value is a comma-separated list of directory / bucket names.
# cyclos.storedFileContentManager.directories =

## Database content manager configuration (default)
cyclos.storedFileContentManager = db

## File system content manager configuration
# cyclos.storedFileContentManager = file
## This is the default parent folder used for all cases not supporting a directory (e.g custom/profile/configuration images, 
## shared documents, etc), the property 'cyclos.storedFileContentManager.directories' is not set or 
## no directory is selected for those cases supporting it.  
# cyclos.storedFileContentManager.rootDir =
# cyclos.storedFileContentManager.maxSubDirs = 100

## Amazon Simple Storage Service (Amazon S3) content manager configuration.
# cyclos.storedFileContentManager = s3
## This is the default bucket used for all cases not supporting a directory (e.g custom/profile/configuration images, 
## shared documents, etc), the property 'cyclos.storedFileContentManager.directories' is not set or 
## no directory is selected for those cases supporting it.  
# cyclos.storedFileContentManager.bucketName =
## This is the default region (e.g: us-west-1), used for the default bucket and for all buckets not defining a region.
## To define a region for a specific bucket, set: cyclos.storedFileContentManager.regionName.bucket_name=region_name   
# cyclos.storedFileContentManager.regionName =
## Both serviceEndpoint and signinRegion can be used to use another S3 provider, such as DigitalOcean
# cyclos.storedFileContentManager.serviceEndpoint =
# cyclos.storedFileContentManager.signinRegion =
## Authorization information
# cyclos.storedFileContentManager.accessKeyId = 
# cyclos.storedFileContentManager.secretAccessKey =
## Custom builder settings. For example, set path-style access to connect to third-party S3 providers,
## such as min.io which doesn't support virtual-hosted style access.
# cyclos.storedFileContentManager.builder.pathStyleAccessEnabled = true
## Custom client settings. For example, set the AWSS3V4SignerType to connect to third-party S3 providers,
## such as min.io which doesn't support the default, legacy signer.
# cyclos.storedFileContentManager.client.signerOverride = AWSS3V4SignerType

## Google Cloud Storage content manager configuration.
# cyclos.storedFileContentManager = gcs
## This is the default bucket used for all cases not supporting a directory (e.g custom/profile/configuration images, 
## shared documents, etc), the property 'cyclos.storedFileContentManager.directories' is not set or 
## no directory is selected for those cases supporting it.  
# cyclos.storedFileContentManager.bucketName = 
## The credentials file points to the JSON file downloaded from Google Cloud Platform Credentials page.
# cyclos.storedFileContentManager.credentialsFile = 

## Custom content manager configuration
## Specify the fully-qualified name of a Java class implementing org.cyclos.impl.storage.StoredFileContentManager
# cyclos.storedFileContentManager = <classname> 

### Temporary path
# Cyclos needs to store temporary files at runtime. This setting specified the location.
# The following variables can be used (and are replaced by the correct value in runtime):
# * %w: The root path of the web application
# * %t: The Java default temporary directory
cyclos.tempDir = %w/WEB-INF/temp

### Load balancers / Proxies
## In some deploys, intermediate proxy hosts act as load balancers, generating a new HTTP request to Cyclos.
## The new requests normally carry on additional information from the original request.
## The following settings contain the names of headers that contain such information. 
## When left empty (default) it is assumed that the request came directly from the end user.
# Header containing the IP address of the original request. The de-facto standard value is X-Forwarded-For
cyclos.header.remoteAddress =
# The value for the header given above, is a comma-separated list containing the IP of any intermediate proxy.
# The following property (valid only if 'cyclos.header.remoteAddress' is given) contains the index used to access such list.
# A negative index can be used, indicating an offset from the end of the list. Thus -1 means the last IP, -2 the last
# but one, an so on. The default value is 0.
# It is strongly recommended to use a negative value to avoid a malicious user perpetrating an IP spoofing attack
# E.g if behind an Apache Web Server or AWS Elastic Load Balancer the value should be -1, 
# for a Google Cloud external HTTP(S) Load Balancer should be -2 (it adds two IP: client IP and load balancer IP)
cyclos.header.remoteAddress.index = 0
# Protocol of the original request. The de-facto standard value is X-Forwarded-Proto
cyclos.header.protocol =

### Rate limit
## Cyclos has a web service API (the same used by the main web application) that allow some
## calls as guests. Is is, thus, an important measure to improve robustness against DoS attacks
## is to apply rate limits. Rate limits are expressed in requests per second, and 2 limits can
## be used: global (for any client) and per IP address. It is also possible to set one or more
## IP addresses that are white listed, that is, never have rate limits applied.
## When using a clustered environment, this applies only to the current node, not for the entire cluster.
# The maximum number of requests per second for all IP addresses. When left blank or zero, is not applied.
# cyclos.rateLimit.global = 100
# The maximum number of requests per second per IP address. When left blank or zero, is not applied.
# cyclos.rateLimit.ip = 10
# The space (or comma) separated list of IP addresses which are never limited
# cyclos.rateLimit.whitelist =

### Session management
# Indicates whether sessions are valid from any IP address (true) or only the original IP address
# that created it (false). Restricting sessions (false) helps improving security, because if a session
# token is somehow stolen, anyone in the world can use this session token and impersonate the user.
# This is the default behavior.
# However, sometimes organizations have a pool of outbound Internet connections, and the IP address
# varies. Or in mobile networks, the user may switch between Wi-Fi, 3g, etc, all with different addresses.
# In such case, it is mandatory to allow the same session to be used, or the user will experience several
# disconnects. As this scenario is more and more common, and any client might have such multiple connections
# setup, sessions are allowed from any IP address by default.
cyclos.sessions.anyAddress = true

### Identifier masks
# Most of the time, it's a good practice to mask identifiers sent to clients, so it's harder to guess valid ones
# Can be one of the following:
# * cipher: Applies a cipher algorithm to identifiers. This is the default
# * none: Doesn't change identifiers. Useful when debugging
# <fully-qualified name of a Java class> A custom class name which implements org.cyclos.impl.utils.IdMask
cyclos.idMask = cipher

### NFF Token Principal types (User identification methods) 
# The NFC types require an encryption key to allow the management of the corresponding NFC tokens.
# The following values (case-insensitive) are valid for the key generation:
# * random: Uses a cryptographically strong random number generator (RNG) to generate the key.
# * zero: Uses a fixed default key of 16 bytes long with all bytes in zero. This is the default.
# * <key>: Fixed custom key of 16 bytes long expressed in Hexadecimal notation, i.e. 32 Hexadecimal characters).
cyclos.nfcTokenTypeKey = zero

### Maximum BCrypt strength
# This is the maximum strength allowed on password types whose input method is text box.
# The larger is this number, the safer are the stored passwords against brute force.
# Every increment on this number makes it take twice the time to encode a password.
# Here are some examples of time taken by a 3rd gen Core i5 system to encode passwords:
# * strength = 4, time = 2ms
# * strength = 6, time = 5ms 
# * strength = 10, time = 80ms 
# * strength = 12, time = 320ms 
# * strength = 14, time = 1290ms
# * strength = 16, time = 5170ms ... 
# Ultimately, the strength is set in the password type, but this setting prevents unmanaged networks from error or abuse.
# The allowed BCrypt strength ranges from 4 to 31.
cyclos.maxBCryptStrength = 12

### Maximum background tasks
# Sets the maximum number of background tasks to be executed at any given time.
# Setting this to zero or the related 'cyclos.maxRecurringTasks' effectively disables both background and recurring tasks.
# The default value is 'auto' (without single quotes), which resolves to: number_of_cpu_cores.
cyclos.maxBackgroundTasks = auto

### Maximum recurring tasks
# Sets the maximum number of recurring tasks to be executed at any given time.
# Setting this to zero or the related 'cyclos.maxBackgroundTasks' effectively disables both background and recurring tasks.
# The default value is 'auto' (without single quotes), which resolves to: min(8, ceil(number_of_cpu_cores / 2)). 
# When 'auto' is set (without single quotes), it never returns a value greater than 8.
cyclos.maxRecurringTasks = auto

### Dump all errors on console
# When set to true, all errors will be dumped to the application server console, easing debugging
# Defaults to false
cyclos.dumpAllErrors = true

### Enable CORS HTTP headers
# If the server is used by Ajax requests from other domains, CORS needs to be enabled.
# To enable CORS from any host, use *. To enable from a particular address, use a comma-separated list of URLs
#cyclos.cors.origin = *

### Rest API reference page
# Enables or disables the API reference page at <root>/api.
# The API methods themselves in /api/* are always enabled, and access can be controlled in Cyclos channels
# Defaults to true.
cyclos.rest.reference = true

### Cleanup
# Number of days messages on trash should be kept before being permanently removed.
# Zero means never remove. Defaults to 30. 
cyclos.purgeMessagesOnTrash.days = 30

# Number of days notifications should be kept before being permanently removed.
# Zero means never remove. Defaults to 30. 
cyclos.purgeNotifications.days = 30

# Number of days user registrations pending e-mail confirmation should be kept before being permanently removed.
# Zero means never remove. Defaults to 7. 
cyclos.purgeUnconfirmedUsers.days = 7

# Number of days user login logs are stored before being permanently removed.
# Zero means never remove. Defaults to 365. 
cyclos.purgeLoginLogs.days = 365

# Number of days unexpired sessions will be purged from the database.
# Zero means never remove. Defaults to zero. 
cyclos.purgeSessions.days = 0

# Number of days the system will wait for a pending external user payment before expiring it and returning the reserved amount to the payer.
# Zero means never expire. Defaults to 30.
cyclos.expireExternalPayments.days = 30

# Number of days the system will wait for imports to be either archived (if processed) or removed).
# Zero means never archive. Defaults to 30.
cyclos.archiveImports.days = 30

# Number of days the system will wait for account fee logs (executions) to have the relationship to user accounts removed.
# Archived fee logs don't have the search affected users tab.
# Zero means never archive. Defaults to 0.
cyclos.archiveAccountFees.days = 0

# Number of days the system will wait for bulk actions (executions) to have the relationship to users removed.
# Archived bulk actions don't have the search affected users tab.
# Zero means never archive. Defaults to 0.
cyclos.archiveBulkActions.days = 0

### Accounts verification configuration
## Cyclos will daily, at 01:00 am, close the balances for accounts which had transfers and,
## optionally, check for check for inconsistent cached balances in accounts.
## Although the chance for an inconsistent balance is low, and can be greatly reduced by using the settings
## 'Lock origin account' and 'Lock destination account' in payment type, it can still happen.
## Account balances are closed daily, but inconsistent cached balances, which can be a heavy operation,
## can be configured to run on specific week days or not run at all. Set to either:
## - always: Check for cached balance inconsistencies every day. This is the default.
## - never: Never check for cached balance inconsistencies. Accounts can be manually checked.
##   See https://documentation.cyclos.org/current/cyclos-reference/#scripting-type-run-directly-example-fix-balances 
## - Comma-separated list of week days, being 0 = Sunday, 1 = Monday, ... 6 = Saturday 
#cyclos.accountsVerification.balanceCheckDays = always

### Retention period (archiving) for banking data
## For more details, see https://documentation.cyclos.org/current/cyclos-reference/#setup-adjustments-archiving
# cyclos.archiving.months = 0
# cyclos.archiving.url = http://localhost:8780
# cyclos.archiving.user = 
# cyclos.archiving.password = 
# cyclos.archiving.trustAllCerts = false
# cyclos.archiving.waitTimeBetweenDeletesMillis = 2000
# cyclos.archiving.deleteStartHour = 0
# cyclos.archiving.deleteDurationMinutes = 240

### Caches
# Caches can be used to prevent excessive round-trips to the database, improving performance at cost of extra memory.
# There are several caches used by Cyclos, whose names are:
#  configurationAccessor, configurationImages, channels, configurationChannel, productsAccessor, groups, 
#  requestData, license, extensionPoints, customizedTranslations, dataTranslations, transferTypes, customWebServices, 
#  table.<table-name>
# Cyclos uses Guava caches, and support some of its configuration properties:
# * maximumSize: Defines the maximum number of cached elements. Setting to zero will effectively disable cache
# * expireAfterWrite: Defines a timeout (like 60s, 10m or 1h) for the elements to expire after being written to cache
# * expireAfterAccess: Defines a timeout (like 60s, 10m or 1h) for the elements to expire after being last accessed
# * concurrencyLevel: Defines the number of threads which can modify the cache concurrently. The default is 4.
# Basically, cyclos.cache.default.<property> will apply that configuration property to all caches by default, while
# cyclos.cache.<name>.<property> will apply that configuration property to the specific cache.
cyclos.cache.default.maximumSize = 10000
cyclos.cache.default.expireAfterAccess = 12h

# The query cache may be disabled altogether. If used, the configuration will be read from cyclos.cache.table.<table-name>.
# Not all tables are cached, only those which doesn't change frequently, because on every insert / update / delete,
# the entire table cache is cleared. As usual, a benchmark can be conducted to find the best balance, but in most cases,
# it is advised to enable the query cache.
cyclos.cache.queries = true

### Logging
# Cyclos can generate logs either on rotating files, to an external database or to the console (standard output).
# See the cyclos.log property below for more information on the available configuration options for each case. 

## General log settings
# Indicates whether logging is generated synchonously (true) or asynchronously (false - default).
# Setting it to true will delay requests until the log is written,
# which raises response times at exchange of a greater confidence that logs are actually written.
cyclos.log.synchronous = false

## Log to files (default)
cyclos.log = file
# Directory where to write log files. Supports the following variables:
# * %w: The root path of the web application
# * %t: The Java default temporary directory
# * %n: The network internal name
# The Docker image user /var/log/cyclos as log directory
cyclos.log.dir = /var/log/cyclos
# The maximum number of rotating log files per network
cyclos.log.maxFiles = 5
# The maximum size per log file. Can end with K for kilobytes or M for megabytes
cyclos.log.maxFileSize = 1M

## Log to an external database. The cyclos.log.datasource prefix configures the datasource,
## and the available settings are analogous to the settings with the 'cyclos.datasource' prefix.
#cyclos.log = db
#cyclos.log.datasource.provider = hikari
#cyclos.log.datasource.dataSourceClassName = org.postgresql.ds.PGSimpleDataSource
#cyclos.log.datasource.dataSource.portNumber=5432
#cyclos.log.datasource.dataSource.serverName=localhost
#cyclos.log.datasource.dataSource.databaseName = cyclos4_logs
#cyclos.log.datasource.dataSource.user = cyclos
#cyclos.log.datasource.dataSource.password = cyclos
#cyclos.log.datasource.maximumPoolSize = auto

## Log to console
# cyclos.log = console

## Disable logging
# cyclos.log = none

## Custom log manager
## Specify the fully-qualified name of a Java class implementing org.cyclos.impl.logging.LogProvider
# cyclos.log = <classname>

### E-mails
# Minimum time to wait between sent e-mails. Sometimes large bursts of e-mails are sent. This setting avoids
# problems with providers that limit the amount of e-mails sent per a given amount of time. 
cyclos.mail.sleepSeconds = 1

### Custom response headers
# It is possible to return custom headers with every response returned by Cyclos.
# All settings like cyclos.responseHeader.<name> = <value> are sent as response headers. 
# By default, the following are used:
# cyclos.responseHeader.X-Frame-Options = SAMEORIGIN
# cyclos.responseHeader.X-XSS-Protection = 1; mode=block

### Web services
# Defines whether to apply GZIP compression to /api and /web-rpc responses.
# When enabling will consume less network band at cost of higher cpu / memory.
# Defaults to true
cyclos.ws.gzip = true

### Issue reports
# To respond quicker and better to critical issues, 
# starting with 4.14.8 Cyclos will send a report to the Cyclos license server if a critical bug occurs.
# This is totally anonymous (metadata only) and can be disabled by setting the following property in true (not recommended) 
cyclos.license.ignoreIssueReports = false

## Maximum number of entries to collect when profiling is started.
cyclos.profiling.maxEntries = 10000
