Configuring Lime CRM¶
Configuration is a key element in Lime CRM.
There are three ways to configure Lime CRM, each with their own merits
Lime Admin¶
Lime Admin is a graphical user interface to configure large parts of Lime CRM. Is is available via the Web Client for Administrators. Add-ons can extended Lime Admin with there own configuration
Environment configuration¶
This configuration scope is reserved for the particular environment where your solution is running. Typically it contains global parameters that you wouldn't (and shouldn't) use anywhere else, such as system configuration or anything specific for that particular environment.
For on-premise solutions, this configuration is contained in one or more
server-wide config.yml
file.
Tip
Note that the config.yml
file also can be named config.yaml
. If both these files exist, the file with .yml
suffix takes precedence.
The config.yml
is located in the <service dir>
and differs depending
on the type of service and platform.
For Windows, the location is %programdata%\Lundalogik\LIME Pro Server\<service name>\configs
,
For Linux, the location is /etc/lime/<service name>
, such as:
/etc/lime/Event Handler/config.yml
Tip
Note that the Web Server and Event Handler use separate configuration files
Application Configuration¶
Starting with Lime CRM version 2020.2, there is a possibility of configuring different applications in Lime CRM running on the same Lime CRM Server. This works both for Lime CRM Cloud applications as well as for on-premise installations running multiple applications.
Concept¶
The concept of application-level config is that we now have a way of entering configuration for different applications running on the same Lime CRM server, that does not live in the database, like the lime_data
runtime configuration. The big drawback of the runtime configuration is that if you perform database backups from one environment (e.g. production) to another(e.g. test), you could end up with e.g. pointing a test installation towards a 3rd party system, with both endpoints and API keys ready to use. The application configuration is architected to support this exact use-case, letting applications' environment-level configuration stay in each environment; since the configuration lies within the environment rather than in the database, config entries such as URL:s to 3rd party systems and API keys won't follow database restores.
For this configuration, each application has a dict
-like datastructure with configuration and secrets. We could conceptually represent this as YAML:
my-application:
config:
my_erp_system:
endpoint_url: https://my_erp_system.example.com
secrets:
my_erp_system:
api_key: oh-so-secret
another-application:
config:
secrets:
In the above YAML blob, we see that each application's configuration has two root keys, config
and secrets
. It's probably self-explanatory what goes where - in secrets
we add passwords, api keys, shared secrets etc, and in config
we add everything else. Please do not put configuration within other places than this; you'll have a hard time to fetch it.
Note
Keys in camelCase are not supported. Fetching such keys (e.g. lime_config.get_app_config(application, 'myFeature')
will always result in None being returned.
Configuring an On-Premise Installation¶
For Windows On-Premise installations, the application-level configuration is expressed in the file %programdata%\Lundalogik\LIME Pro Server\application_config.yaml
. If it does not already exist, just create it.
Note
Unlike config.yml
, the application_config.yaml
file is shared by all services. That means that if you wish to add configuration for both the web server and the task handler, you only need to edit configuration once.
Fetching application's configuration¶
Application configuration can be accessed programmatically by importing lime_config
and calling the function get_app_config
, e.g.:
value = lime_config.get_app_config(application: LimeApplication, "key": string)
It is also possible to fetch the entire configuration object by omitting the key in the above function. For more examples, please refer to the function's docstring.
Where to find an application's application configuration¶
The path for the application config file can be overridden using the environment variable, LIME_CONFIG_DIR
.
Note
For local development, the file usually lives in .lime/config/
.