The Config Module (tendril.config.legacy
)¶
This module provides the core configuration for Tendril.
The Tendril configuration file is itself a Python file, and is imported
from it’s default location (INSTANCE_ROOT/instance_config.py
, where
INSTANCE_ROOT is ~/.tendril
). In case this folder needs to be moved
elsewhere, such as when it needs to be run via wsgi using the web server’s
user, the INSTANCE_ROOT can be moved by placing a file in the user’s
home directory (~/.tendril/redirect
), containing the path to the
actual instance folder.
The instance_config.py
file is the primary configuration for Tendril.
It is intended to be maintained at an Instance level by the tendril
administrator. Since some parameters may need to be changed per-installation
to adapt it to the user’s setup, an additional configuration file can be
added in (INSTANCE_ROOT/local_config_overrides.py
), containing only those
parameters which the user wishes to override.
When the configuration is parsed during startup, (at the time of the first
import of the config module) this module performs the import using the
tendril.utils.fsutils.import_()
function and the imp
module.
Each recognized config option and variable is obtained from the first
location where it is found from the following list of sources:
local_config_overrides.py
instance_config.py
The defaults specified here.
The following constraints should be kept in mind when setting up your configuration :
The configuration files are all python files. You can execute pretty much whatever you want within them, as long as the final configuration value ends up in the module namespace at the correct variable.
The order of the config parameters is somewhat important. The actual configuration values can be constructed at run time from configurations parameters which already exist in the namespace.
The core config module (this one) uses
eval()
to execute thedefault
strings. The values ininstance_config
andlocal_config_overrides
, however, are used as is. As such, each option or constant specified in one of those files must be fully specified within that file - it can’t, for instance, use the INSTANCE_ROOT value to construct paths unless it defines it for itself.Configuration constants will be set in the instance and local config modules. Configuration options will not.
Configuration Options¶
Option |
Default |
Description |
---|---|---|
Options to configure paths for various local resources |
||
AUDIT_PATH |
os.path.join(INSTANCE_ROOT, ‘manual-audit’) |
Folder where files generated for manual audit should be stored |
INSTANCE_CACHE |
os.path.join(INSTANCE_ROOT, ‘cache’) |
Folder within which the tendril instance should store it’s cache(s).Make sure the the users running tendril (as well as the webserver, if the web frontend is being used) have write access to this folder. |
SVN_ROOT |
os.path.join(INSTANCE_ROOT, ‘projects’) |
Common ancestor for all VCS checkout folders. While tendril will try to descend into this folder indefinitely, avoid using overly generic paths (like ‘/’ or ‘~’) to avoid surprises and preserve performance. |
PROJECTS_ROOT |
SVN_ROOT |
Common ancestor for all project folders. Use this if your projectsare in a single sub-tree of your VCS_ROOT, for example. While tendril will try to descend into this folder indefinitely, avoid using overly generic paths (like ‘/’ or ‘~’) to avoid surprises and preserve performance. |
Options to configure the ‘filesystems’ containing instance resources |
||
DOCSTORE_ROOT |
os.path.join(INSTANCE_ROOT, ‘docstore’) |
Folder for the docstore filesystem |
REFDOC_ROOT |
os.path.join(INSTANCE_ROOT, ‘refdocs’) |
Folder for the refdocs filesystem |
SHAREDCACHE_ROOT |
os.path.join(INSTANCE_ROOT, ‘cache’, ‘shared’) |
Folder for the shared cache filesystem |
SVN_SERVER_ROOT |
None |
Path to the SVN root on the SVN server |
Options to configure details of various instance resources |
||
PRINTER_NAME |
{} |
Name of the printer to use for printing. Tendril will use ‘lp -d PRINTER_NAME to print. |
USE_PREFAB_SERVER |
False |
Use Prefab Server |
PREFAB_SERVER |
None |
Pre-assembled Datasets Server URL |
MQ_SERVER |
None |
Message Queue Server Host |
MQ_SERVER_PORT |
5672 |
Message Queue Server Host |
FIREFOX_PROFILE_PATH |
None |
Path to the firefox profile to use for splinter. |
Options to configure third-party infrastructure services integration |
||
APPENLIGHT_PRIVATE_API_KEY |
{} |
Private API key to use with appenlight, if any. |
APPENLIGHT_PUBLIC_API_KEY |
{} |
Public API key to use with appenlight, if any. |
ENABLE_APPENLIGHT |
False |
Whether to use AppEnlight to monitor application. |
PIWIK_SITE_ID |
{} |
Site ID to use with Piwik. |
PIWIK_BASE_URL |
{} |
Base URL of the Piwik instance to use. |
ENABLE_PIWIK |
False |
Whether to use Piwik for analytics. |
Options to configure the gEDA installation and related resources |
||
EDA_HARMONIZE_IDENTS |
True |
Whether to harmonize idents by default. |
Options to configure the frontend |
||
USE_X_SENDFILE |
True |
Whether to use X-SENDFILE to send files from the web frontend. Note that your web server must also support and be configured to do this. |
Options to configure e-mail |
||
MAIL_USERNAME |
None |
The username to authenticate with the SMTP server |
MAIL_PASSWORD |
None |
The password to authenticate with the SMTP server |
MAIL_DEFAULT_SENDER |
None |
The sender to use when sending emails |
MAIL_SERVER |
None |
The host of the SMTP server to use |
MAIL_PORT |
None |
The port of the SMTP server to use |
MAIL_PORT |
587 |
The port of the SMTP server to use |
MAIL_USE_SSL |
True |
Whether to use SSL when sending emails |
MAIL_USE_TLS |
False |
Whether to use TLS when sending emails |
Options to configure security features |
||
ADMIN_USERNAME |
None |
The username for the first Admin user |
ADMIN_FULLNAME |
None |
The full name for the first Admin user |
ADMIN_EMAIL |
None |
The e-mail for the first Admin user |
ADMIN_PASSWORD |
None |
The password for the first Admin user |
SECRET_KEY |
None |
The secret key for the frontend authentication system |
Options to configure instance information |
||
INSTANCE_SOURCES |
“https://github.com/chintal/tendril” |
The location of the sources of the tendril code used by the instance |
INSTANCE_FOLDER_SOURCES |
“https://github.com/chintal/tendril-instance-cookiecutter” |
The location of the sources of the tendril instance folder used by the instance |
INSTANCE_DOCUMENTATION_PATH |
“http://tendril.chintal.in/doc” |
The location of the documentation related to the instance |
Options to configure inventory details |
||
INVENTORY_LOCATIONS |
[] |
A list of names of inventory locations |
ELECTRONICS_INVENTORY_DATA |
[] |
A list of dictionaries specifying the locations and formats of inventory data. |
Options to configure vendor details |
||
VENDOR_DEFAULT_MAXAGE |
-1 |
The maximum age in seconds after which sourcing information is considered stale. Set to -1 for no checks. The continuous background update is pretty unwieldy at present. |
VENDOR_MAP_FOLDER |
os.path.join(INSTANCE_ROOT, ‘sourcing’, ‘maps’) |
The folder in which vendor maps should be dumped |
VENDOR_MAP_AUDIT_FOLDER |
os.path.join(AUDIT_PATH, ‘vendor-maps’) |
The folder in which the vendor maps audits should be dumped |
PRICELISTVENDORS_FOLDER |
os.path.join(INSTANCE_ROOT, ‘sourcing’, ‘pricelists’) |
The folder in which the price lists for pricelist vendors are located. |
CUSTOMSDEFAULTS_FOLDER |
os.path.join(INSTANCE_ROOT, ‘sourcing’, ‘customs’) |
The folder in which customs defaults are located. |
OCTOPART_API_KEY |
None |
The OctoPart API Key to use for vendors based on the OctoPart API. |
MOUSER_API_KEY |
None |
The Mouser API Key to use for Mouser Electronics. |
ARROW_API_KEY |
None |
The Arrow API Key to use for Arrow Electronics. |
ARROW_API_LOGIN |
None |
The username to use with the Arrow API |
VENDORS_DATA |
[] |
A list of dictionaries containing vendor details, one for eachconfigured vendor. |
Options to configure tendril execution behavior |
||
SUPPORT_INTERPRETER_PERSISTENCE |
False |
Whether tendril should support interpreter persistence. This is generally in the form of maintaining in-memory caches, reloading sources from the filesystem, etc. This slows startup time, and therefore is only appropriate for server deployments. |
WARM_UP_CACHES |
False |
Whether tendril caches should be warmed up on startup. This significantly slows startup time, and therefore is only appropriate for server deployments. |
ENABLE_THREADED_CONNECTORS |
False |
Whether threaded connectors to external services should be used. These connectors only provide interfaces to allow response to asynchronous external events, and are only appropriate for server deployments. These threaded connectors are currently used only in cases where a synchronous service is not viable, so disabling this will disable all features dependent on it. On the the other hand, these threads may introduce some unresolved instability. |
Configuration Constants¶
Option |
Default |
Description |
---|---|---|
Basic config constants |
||
TENDRIL_ROOT |
os.path.normpath(os.path.join(CONFIG_PATH, os.pardir, os.pardir)) |
DEPRECATED. Path to the tendril package root. |
INSTANCE_ROOT |
os.path.join(os.path.expanduser(‘~’), ‘.tendril’) |
Path to the tendril instance root. Can be redirected if necessarywith a file named ``redirect`` in this folder. |
Configuration constants, following INSTANCE_ROOT redirection if needed |
||
INSTANCE_CONFIG_FILE |
os.path.join(INSTANCE_ROOT, ‘instance_config.py’) |
Path to the tendril instance configuration. |
LOCAL_CONFIG_FILE |
os.path.join(INSTANCE_ROOT, ‘local_config_overrides.py’) |
Path to local overrides to the instance configuration. |
Filesystems related constants |
||
DOCUMENT_WALLET_PREFIX |
‘wallet’ |
Prefix for the Document Wallet in the expose hierarchy |
DOCSTORE_PREFIX |
‘docstore’ |
Prefix for the Docstore in the expose hierarchy |
REFDOC_PREFIX |
‘refdocs’ |
Prefix for refdocs in the expose hierarchy |
SHAREDCACHE_PREFIX |
‘sharedcache’ |
Prefix for sharedcache in the expose hierarchy |
-
class
tendril.config.legacy.
ConfigConstant
(name, default, doc)[source]¶ Bases:
object
A configuration constant. This is fully specified in this file and cannot be changed by the user or the instance administrator without modifying the core code.
The value itself is constructed using
eval()
.-
property
value
¶
-
property
-
tendril.config.legacy.
load_constants
(constants)[source]¶ Loads the constants in the provided list into the module namespace.
- Parameters
constants – list of
ConfigConstant
- Returns
None
-
class
tendril.config.legacy.
ConfigOption
(name, default, doc)[source]¶ Bases:
object
A configuration option. These options can be overridden by specifying them in the
instance_config
andlocal_config_overrides
files.If specified in one of those files, the value should be the actual configuration value and not an expression. The default value specified here is used through
eval()
.-
property
value
¶
-
property
-
tendril.config.legacy.
load_config
(options)[source]¶ Loads the options in the provided list into the module namespace.
- Parameters
options – list of
ConfigOption
- Returns
None
-
tendril.config.legacy.
doc_render
(group)[source]¶ Converts a list of
ConfigOption
orConfigConstant
into a list compatible withsphinxcontrib.documentedlist
for generating the configuration parameter documentation.