[Top] [Contents] [Index] [ ? ]

Acme - An Application Configuration ManagEr

This is Acme library documentation


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1. Introduction

Acme is an Application Configuration ManagEr.

You can get a copy and this manual at http://mmontone.github.io/acme


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.1 Summary

Acme is an Application Configuration ManagEr


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.2 Installation

Download Acme, or clone the git repository from https://github.com/mmontone/acme. Then run sudo sudo python ./setup.py install. That installs acme the acme binary on /usr/local/bin. After that, you can run acme typing acme at the shell.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.3 Feedback

Mail marianomontone at gmail dot com with feedback


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.4 Conventions

Hear are some coding conventions we’d like to follow


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

2. Overview

Acme is an Application Configuration ManagEr. It is written in Python and provides a Tk GUI at the moment.

The idea is to define configuration schemas and get a proper way of:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3. Running


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1 Running overview

Acme is run invoking acme command from the command line. By default, it runs in normal mode; that means, it opens a GUI for adding, removing and editing configurations.

A configurations schemas files is required. By default, Acme looks for acme.schema in the current directory. It shows and errors if it can not find it. A different file or location can be specified through the –schemas SCHEMAS option.

If the schemas file is found, then it is parsed and loaded. The schemas file is in XML format.

Apart from that, Acme maintains configurations in another file, which by default is acme.config. It can be specified to be something else through the –configs CONFIGS option.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.2 Running modes

Acme can be run in three different modes fundamentally.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.3 Command line summary

$> acme -h

usage: acme [-h] [-f] [-s SCHEMAS] [-c CONFIGS] [-l]
                    [-i INSPECT_CONFIG] [-g GET] [--set SET] [--config CONFIG]
                    [--validation VALIDATION] [--validate VALIDATE]
                    [--validate-all] [--json] [--setup] [--debug DEBUG]

Acme. Application Configuration ManagEr.

optional arguments:
  -h, --help            show this help message and exit
  -f, --full            Run the full acme (both configurations and
                        schemas navigation)
  -s SCHEMAS, --schemas SCHEMAS
                        The configuration schemas files. Default is
                        acme.schema
  -c CONFIGS, --configs CONFIGS
                        The configurations file. Default is
                        acme.config
  -l, --list-configs    List configurations
  -i INSPECT_CONFIG, --inspect-config INSPECT_CONFIG
                        Inspect a configuration. A CSV(Comma separated values)
                        list with <option path>, <value>, <option type>,
                        <origin>
  -g GET, --get GET     Get an option value
  --set SET             Set an option value
  --config CONFIG       Edit a specific configuration
  --validation VALIDATION
                        Enable or disable configurations validation
  --validate VALIDATE   Validate a configuration. Pass the configuration name
  --validate-all        Validate all configurations
  --json                Use JSON for communication
  --setup               Edit configuration schemas
  --debug DEBUG         Run in debug mode. Provide the debugging level, one of
                        DEBUG or INFO

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Configuration schemas

Configuration schemas define the configurations structure. They have a name, a list of parents, and a list of sections with options definitions.

images/newschema

Configuration schemas can be composed by inheriting from multiple parents. Configuration sections from the parents appear in the child configuration schema. For instance, a full stack web framework configuration schema could inherit from a generic Web schema for web server configuration, and another Database schema for database connection configuration.

Configuration schemas have sections, each containing other sections and schema options. The schemas sections and options can be manipulated in the tree appearing on the left of the configuration schemas navigator.

images/schemas_navigation
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Schema sections

Each configuration schema section has a name, a documentation, subsections and a list of option schemas. Sections, subsections, and sections’ options can all be added and removed from the tree widget on the left of the schemas navigator.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Schema options

Options in schemas have a name and a type.

images/schema_option

The type of option determines the possible values that can be assigned to it in configurations. The option type can be String, Number, Boolean, Email, URI, Filename, Directory, Color, Timezone, Language, Country, Currency, Date, Time, Datetime, etc. Some of them will be described later. When editing configurations, each option is edited with its corresponding editor, depending on the type of option. For instance, options of type Date are edited using a calendar.

images/option_editing

Apart from name and type, schema options specify if it required for the option to be assigned a value in the configuration. Also, they can have a default value in case the user doesn’t assign one in the configuration.

They also have a documentation string. This is very important for the end user to know the option meaning.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2.1 Options dependencies

It often happens that some options only make sense when some others are set to certain values. For instance, if we are configuring a database, then specific database engine options should only be available when the the specific engine is selected. Or a list of options make sense only when a boolean option is enabled.

Acme has support for that by attaching a dependencies expression to an option schema. The dependency expression is written in a very simple domain specific language. They are basically boolean expressions, with options being referenced.

Example: MySQL supports two storage engines, MyISAM and InnoDB, but this option only makes sense for MySQL. To specify that, we can use the following dependencies expression: Database.Engine = 'MySQL'. This way the Storage engine option will only be editable when the Database.Engine is set to ’MySQL’.

Dependency expressions can be added in the schema option editing screen:

images/dependencies
[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3 Built-in option types


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.1 String

The String option type ensures that the the option value is of type string.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.2 Number

The Number option type ensures that the the option value is of type Number.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.3 Boolean

The boolean option type ensures that the the option value is of type boolean (True or False).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.4 Email

The email option type ensures that the the option value is a valid email string.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.5 Url

The url option ensures that the the option value is a valid url.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.6 Filename

The pathaname option type ensures that the the option value is a valid pathname and the file or directory exists.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.7 Choice

The Choice option type ensures that the option value is one of the options listed.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.3.8 List

The List option type ensures that the option value is a subset of the options listed.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5. Configurations

Configurations are instances of Configuration schemas, much like objects are instances of classes in object oriented programming languages. That is, configurations structure is determined by the configuration schema they belong to. In particular, their sections are that of their configuration schemas; and their options values depend on the option schemas defined in the configruration schemas.

Configurations belong to one and only one configuration schema, and that’s compulsory, as it can be expected. Besides, configurations can inherit from each other: a configuration can inherit from another configuration and overwrite its parent options values. A configuration can have one and only one parent, o no parent; this is different from configuration schemas, that can have several parents. An understandable restriction is that the configuration parent schema has to be the same that the configuration schema.

Configurations can be added and removed from the list appering on the left of the configurations navigator.

images/acme1

Configurations can be loaded and saved. They are serialized in XML format. The default filename is acme.config, but it can be changed if desired.

Configuration options editing happens on the right panel of the configurations navigator. A specific option editor is offered for each type of option, and each option documentation is displayed too. When trying to save a configuration section, it is ensured that required options (options declared with required enabled in the configuration schema) are filled. Options that are not currently set have their default value, if any. Also, options can be set and unset. Setting a configuration option means setting the configuration option in the current configuration to the value being shown in the option editor. Unsetting a configuration option means removing the option value setting from the current configuration.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6. Examples

Schemas definitions:

 
<schemas>
  <schema name="Web">
    <documentation></documentation>
    <section name="Web server">
      <documentation></documentation>
      <option name="Host">
        <documentation>Server host</documentation>
        <type name="String"/>
        <required>True</required>
        <default>http://localhost</default>
      </option>
      <option name="Port">
        <documentation>Port number</documentation>
        <type name="Number"/>
        <required>True</required>
        <default>8080</default>
      </option>
    </section>
    <section name="Authentication">
      <documentation></documentation>
      <option name="Authentication enabled">
        <documentation>Enable authentication?</documentation>
        <type name="Boolean"/>
        <required>False</required>
      </option>
    </section>
    <section name="General preferences">
      <documentation></documentation>
      <option name="Font size">
        <documentation>Font size</documentation>
        <type name="Number"/>
        <required>True</required>
      </option>
      <section name="Colors">
        <documentation></documentation>
        <option name="Background color">
          <documentation>Background color</documentation>
          <type name="Color"/>
          <required>True</required>
        </option>
      </section>
    </section>
  </schema>
  <schema name="App">
    <documentation></documentation>
    <parent name="Database"/>
    <parent name="Web"/>
    <parent name="Log"/>
  </schema>
  <schema name="Log">
    <documentation></documentation>
    <section name="Logging">
      <documentation></documentation>
      <option name="Logfile">
        <documentation>Where the logging happens</documentation>
        <type name="Filename"/>
        <required>True</required>
      </option>
      <option name="Expire">
        <documentation>Expiration</documentation>
        <type name="Datetime"/>
        <required>True</required>
      </option>
    </section>
  </schema>
  <schema name="Database">
    <documentation></documentation>
    <section name="Database server">
      <documentation></documentation>
      <option name="engine">
        <documentation>The database engine</documentation>
        <type name="Choice">
          <option value="Postgresql"/>
          <option value="Mysql"/>
        </type>
        <required>True</required>
      </option>
    </section>
  </schema>
</schemas>

Configurations definitions:

 
<configurations>
  <configuration name="Dev">
    <schema name="App"/>
    <option path="Database.Database server.engine" value="Postgresql"/>
  </configuration>
  <configuration name="Test">
    <schema name="App"/>
    <parent name="Dev"/>
    <option path="Database.Database server.engine" value="Mysql"/>
  </configuration>
  <configuration name="Prod">
    <schema name="Web"/>
    <option path="Web.Authentication.Authentication enabled" value="True"/>
    <option path="Web.General preferences.Colors.Background color" value="#6ed9d9"/>
  </configuration>
</configurations>

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1 Use cases


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1.1 Debugging


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1.2 Logging


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1.3 Testing


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.1.4 Deployment


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7. Frontend

Configurations can be edited from a Tk interface.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8. Custom option types

How to define custom option types


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9. Language bindings

There are language bindings implemented for Python, PHP and Common Lisp for the moment.

Bindings can be found in the bindings directory. For how they are used, look at the tests in the corresponding directory.

In general, bindings ivoke acme from the command line using JSON for communication.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10. System reference


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

11. References


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12. Index


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.1 Concept Index

Jump to:   B   C   D   E   F   I   L   N   O   R   S   T   U  
Index Entry Section

B
boolean4.3.3 Boolean

C
choice4.3.7 Choice
configuration schema4. Configuration schemas
conventions1.4 Conventions

D
debugging6.1.1 Debugging
dependency4.2.1 Options dependencies
deployment6.1.4 Deployment

E
email4.3.4 Email
examples6. Examples

F
feedback1.3 Feedback
filename4.3.6 Filename

I
installation1.2 Installation
introduction1. Introduction

L
list4.3.8 List
logging6.1.2 Logging

N
number4.3.2 Number

O
option4.2 Schema options
option type4.3 Built-in option types
overview2. Overview

R
reference11. References
running3. Running
running3.1 Running overview

S
section4.1 Schema sections
string4.3.1 String
summary1.1 Summary

T
testing6.1.3 Testing

U
url4.3.5 Url

Jump to:   B   C   D   E   F   I   L   N   O   R   S   T   U  

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.2 Class Index


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.3 Function Index


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

12.4 Variable Index


[Top] [Contents] [Index] [ ? ]

Table of Contents


[Top] [Contents] [Index] [ ? ]

About This Document

This document was generated by marian on February 16, 2015 using texi2html 1.82.

The buttons in the navigation panels have the following meaning:

Button Name Go to From 1.2.3 go to
[ < ] Back Previous section in reading order 1.2.2
[ > ] Forward Next section in reading order 1.2.4
[ << ] FastBack Beginning of this chapter or previous chapter 1
[ Up ] Up Up section 1.2
[ >> ] FastForward Next chapter 2
[Top] Top Cover (top) of document  
[Contents] Contents Table of contents  
[Index] Index Index  
[ ? ] About About (help)  

where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:


This document was generated by marian on February 16, 2015 using texi2html 1.82.