This class represents the licensee's environment.
More...
#include <configuration.h>
This class represents the licensee's environment.
this class is responsible for collecting environment variables necessary to override default behavior (e.g. on premise license server url). It also determines information used to lock licenses to the machine it's been operated on.
The following environment variables will be used to get information about the licensee:
- ${PRODUCTNAME}_LICENSE_SERVER -->license server URL (default: https://licensing.digitalwerk.net)
- ${PRODUCTNAME}_LICENSE_FILE --> path to an existing license file or where to save it when a license is activated
- ${PRODUCTNAME}_LICENSE_KEY --> license key acquired from digitalwerk
◆ Configuration() [1/3]
| licme::manager::Configuration::Configuration |
( |
const std::string & | productNameLowerCase | ) |
|
Create a new object containing licensee environment information.
The generated object holds information about the user and host which is necessary to lock the license to this machine. It also holds the license key and other information necessary to activate a license, whether it is a floating or node locked license.
- Parameters
-
| productNameLowerCase | string containing the product under license in lower case letters. this parameter is required in any case and should be provided by the integrator in a non-modifyable fashion. |
- Exceptions
-
| IntegrationException | in case product name is empty |
◆ Configuration() [2/3]
| licme::manager::Configuration::Configuration |
( |
const Configuration & | | ) |
|
Default copy constructor.
◆ Configuration() [3/3]
| licme::manager::Configuration::Configuration |
( |
Configuration && | | ) |
|
|
noexcept |
Default move constructor.
◆ ~Configuration()
| licme::manager::Configuration::~Configuration |
( |
| ) |
|
Destroy the Licensee object.
nothing special about this destructor.
◆ HostName() [1/2]
| std::string_view licme::manager::Configuration::HostName |
( |
| ) |
const |
Get the Host's Name.
- Returns
- Reference to the host's name
◆ HostName() [2/2]
| Configuration & licme::manager::Configuration::HostName |
( |
std::string_view | value | ) |
|
overrride host name
Use this API to set the host name to a value different from the actual OS's host name. Mainly used for testing.
- Parameters
-
| value | new host name to set |
◆ LicenseFile() [1/2]
| std::string_view licme::manager::Configuration::LicenseFile |
( |
| ) |
const |
Get the License File path.
- Returns
- Reference to the license's file path
◆ LicenseFile() [2/2]
| Configuration & licme::manager::Configuration::LicenseFile |
( |
std::string_view | value | ) |
|
override license file path
Set the license file path to a value different from the default path.
- Parameters
-
| value | new license file path to set |
◆ LicenseKey() [1/2]
| std::string_view licme::manager::Configuration::LicenseKey |
( |
| ) |
const |
Get the License Key.
- Returns
- Reference to the license key
- Exceptions
-
| ActivationException | in case license key is empty |
◆ LicenseKey() [2/2]
| Configuration & licme::manager::Configuration::LicenseKey |
( |
std::string_view | value | ) |
|
override license key
License key is most likely read from an environment variable, or provided in the constructor. Nevertheless it might be necessary to change the license key during execution, e.g. for testing.
- Parameters
-
| value | new license key to set |
◆ LicenseServer() [1/2]
| std::string_view licme::manager::Configuration::LicenseServer |
( |
| ) |
const |
Get the License Server URL.
- Returns
- Reference to the URL of the license server
◆ LicenseServer() [2/2]
| Configuration & licme::manager::Configuration::LicenseServer |
( |
std::string_view | value | ) |
|
override license server url
Set license server url to something different than the default value or the one from the environment variable.
- Parameters
-
| value | new license server url to set |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ ProductName()
| std::string_view licme::manager::Configuration::ProductName |
( |
bool | upcase = true | ) |
const |
Get the Product's Name.
Returns the product's name either in upper case (used for accessing environment variables) or lower case letters (used in license file names for this product).
- Parameters
-
| upcase | upper case letter product name if true, lower case letter product name otherwise. |
- Returns
- Reference to the product's name
◆ ProxyAuthHook() [1/2]
| std::function< void(std::string &user, std::string &password)> licme::manager::Configuration::ProxyAuthHook |
( |
| ) |
const |
Returns proxy authentication hook.
- Returns
- std::function<void(std::string& user, std::string& password)>
◆ ProxyAuthHook() [2/2]
| Configuration & licme::manager::Configuration::ProxyAuthHook |
( |
std::function< void(std::string &user, std::string &password)> | hook | ) |
|
hook to setup proxy credentials
Provides a function that will be called when proxy credentials are required. Linux users may provide credentials as basic auth part in HTTP(S)_PROXY environment variable, whereas windows users may provide ProxyAuthHook() if system proxy settings require authentication.
- Parameters
-
| hook | function for requesting proxy credentials |
- Returns
- Configuration&
◆ ProxyHook() [1/2]
| std::function< void(std::string &host, int &port)> licme::manager::Configuration::ProxyHook |
( |
| ) |
const |
Returns proxy setup hook.
- Returns
- std::function<void(std::string& host, int& port)>
◆ ProxyHook() [2/2]
| Configuration & licme::manager::Configuration::ProxyHook |
( |
std::function< void(std::string &host, int &port)> | hook | ) |
|
hook to setup proxy configuration
Provides a function that will be called when proxy settings are required for communication with the server. Linux users may provide proxy settings through HTTP(S)_PROXY environment variable whereas windows users may only need to provide ProxyAuthHook() if system proxy settings require authentication.
- Parameters
-
| hook | function for requesting proxy settings |
- Returns
- Configuration&
◆ RedirectDebugLog()
| Configuration & licme::manager::Configuration::RedirectDebugLog |
( |
std::function< void(const std::string &)> | callback | ) |
|
configure callbacks for logging info messages
- Parameters
-
| callback | function accepting log messages for log level info |
- Returns
- Configuration&
◆ RedirectErrorLog()
| Configuration & licme::manager::Configuration::RedirectErrorLog |
( |
std::function< void(const std::string &)> | callback | ) |
|
configure callbacks for logging error messages
- Parameters
-
| callback | function accepting log messages for log level error |
- Returns
- Configuration&
◆ RedirectInfoLog()
| Configuration & licme::manager::Configuration::RedirectInfoLog |
( |
std::function< void(const std::string &)> | callback | ) |
|
configure callbacks for logging info messages
- Parameters
-
| callback | function accepting log messages for log level info |
- Returns
- Configuration&
◆ UserHomeDirectory() [1/2]
| std::string_view licme::manager::Configuration::UserHomeDirectory |
( |
| ) |
const |
Get the User's Home Directory object.
- Returns
- Reference to the user's home directory
◆ UserHomeDirectory() [2/2]
| Configuration & licme::manager::Configuration::UserHomeDirectory |
( |
std::string_view | value | ) |
|
override user's home directory
Use this API to set the home directory to a path of your choice instead of the user's actual home directory. Mainly used for testing.
- Parameters
-
| value | new home directory path to set |
◆ UserName() [1/2]
| std::string_view licme::manager::Configuration::UserName |
( |
| ) |
const |
Get the User's Name.
- Returns
- Reference to the user's name
◆ UserName() [2/2]
| Configuration & licme::manager::Configuration::UserName |
( |
std::string_view | value | ) |
|
override user's name
Use this API to set a username different to the actual one provided by OS. This is mainly used for testing.
- Parameters
-
The documentation for this class was generated from the following file: