Updating the set of supported configuration file locations

This change adds support for multiple configuration file storage
locations, including the user's home directory and /etc. The preferred
configuration file name is now pykmip.conf. The original name,
kmipconfig.ini, will continue to be supported for legacy installations.
This commit is contained in:
Peter Hamilton 2015-08-25 13:13:58 -04:00
parent 9c7edd65d2
commit 3a4658d5d1
3 changed files with 25 additions and 8 deletions

View File

@ -49,8 +49,19 @@ in ``kmip/demos``.
Configuration Configuration
************* *************
A KMIP client can be configured in different ways to connect to a KMIP server. A KMIP client can be configured in different ways to connect to a KMIP server.
The first method is the default approach, which uses settings found in The first method is the default approach, which uses settings found in the
``kmip/kmipconfig.ini``. Users can specify the connection configuration PyKMIP configuration file. The configuration file can be stored in several
different locations, including:
* ``<user home>/.pykmip/pykmip.conf``
* ``/etc/pykmip/pykmip.conf``
* ``<PyKMIP install>/kmip/pykmip.conf``
* ``<PyKMIP install>/kmip/kmipconfig.ini``
These locations are searched in order. For example, configuration data found
in ``/etc`` will take priority over configuration information found in the
PyKMIP installation directory. The ``kmipconfig.ini`` file name is supported
for legacy installations. Users can specify the connection configuration
settings to use on client instantiation, allowing applications to support settings to use on client instantiation, allowing applications to support
multiple key storage backends simultaneously, one client per backend. multiple key storage backends simultaneously, one client per backend.
@ -113,8 +124,8 @@ The KMIP server provides basic support for the following operations:
Configuration Configuration
************* *************
The KMIP software server also pulls settings from ``kmip/kmipconfig.ini``. The KMIP software server also pulls settings from the PyKMIP configuration
An example server configuration settings block is shown below:: file. An example server configuration settings block is shown below::
[server] [server]
host=127.0.0.1 host=127.0.0.1
@ -127,9 +138,9 @@ An example server configuration settings block is shown below::
do_handshake_on_connect=True do_handshake_on_connect=True
suppress_ragged_eofs=True suppress_ragged_eofs=True
When used together, a KMIP client and KMIP server will use certificate files When used together, a KMIP client and KMIP server by default use certificate
found in ``kmip/demos/certs``. These files should be replaced with alternative files found in ``kmip/demos/certs``. These files should be replaced with
certificates for standalone deployments. alternative certificates for standalone deployments.
Profiles Profiles
======== ========

View File

@ -19,7 +19,13 @@ import os
from six.moves.configparser import SafeConfigParser from six.moves.configparser import SafeConfigParser
FILE_PATH = os.path.dirname(os.path.abspath(__file__)) FILE_PATH = os.path.dirname(os.path.abspath(__file__))
CONFIG_FILE = os.path.normpath(os.path.join(FILE_PATH, '../kmipconfig.ini'))
# TODO (peter-hamilton): Remove support for kmipconfig.ini on future release.
CONFIG_FILE = [
os.path.join(os.path.expanduser('~'), '.pykmip', 'pykmip.conf'),
os.path.join(os.sep, 'etc', 'pykmip', 'pykmip.conf'),
os.path.normpath(os.path.join(FILE_PATH, '../pykmip.conf')),
os.path.normpath(os.path.join(FILE_PATH, '../kmipconfig.ini'))]
class ConfigHelper(object): class ConfigHelper(object):