Skip to main content

Core GS config.

Project description

Authors:

Richard Waid

Michael JasonSmith

Contact:
Michael JasonSmith <mpj17@onlinegroups.net>
Date:
2015-03-17
Organization:
GroupServer.org

Introduction

Sometimes configuration is complex, such as when multiple sets of configuration is needed because multiple instances of a system (such as GroupServer [1]) are running on the same setup. In this case each instance is made up of a set of components, and each component is made up of configuration options:

  • Instance

    • Component

      • Configuration options

      • More configuration options

    • Component 2

      • Different configuration options

  • Another instance

Sadly the ConfigParser system does not allow for this hierarchy, but gs.config does, by using the name space to provide the relationship between an instance and the component. In particular, this product supplies a Config class to read a file of a particular structure.

Config Class

The gs.config.Config class that represents the system configuration. See the Sphinx documentation in this module for more information.

File

The instance is marked with the name [config-${name}], where ${name} is the name of the instance. For example [config-production] for the instance production.

For each component the set of sections is then supplied:

[config-production]
database = production
smtp = external
cache = production
tokenauth = production

The configuration for a component can be shared by multiple instances:

[config-staging]
database = production
smtp = dead
cache = none
tokenauth = production

Each component is a configuration section, with a name of the form [${component}-${name}]. For example [smtp-external] for the smtp section named external.

Example

In the example below three instances are configured: one for a test-server, one for a staging server, and one for a production server. Each instance has two components: a database, and an SMTP server:

[config-test]
database = test
smtp = test

[config-staging]
database = live
smtp = test

[config-production]
database = live
smtp = live

# An actual configuration section for each configuration set
[database-test]
dsn = postgres://name:pass@server/database-test

[database-live]
dsn = postgres://name:pass@server/database-live

[smtp-test]
server = localhost
port = 2525

[smtp-live]
server = external
port = 25

When the configuration is instantiated, an ID is passed. This ID identifies the configuration set that is currently being accessed. If an ID is not passed, an attempt is made to get the ID from the environment automatically. At the moment this is specific to the GroupServer environment, though care is taken to ensure that it will fall back gracefully to being passed an ID.

Resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gs.config-2.1.2.zip (27.1 kB view details)

Uploaded Source

File details

Details for the file gs.config-2.1.2.zip.

File metadata

  • Download URL: gs.config-2.1.2.zip
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for gs.config-2.1.2.zip
Algorithm Hash digest
SHA256 1bba953ff938d7adcf6ac28d9854aeb8cb5450ae0435111e83ac272838c3fc76
MD5 8cfe1411ee42960372f76a7e3e0b8bae
BLAKE2b-256 11bd0a39fca32c495aa2025e694f1e9a605784019d198518a233bf13d35efe65

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page