Module tomatic.buckets

Bucket classes and routines.

Classes

class BaseBucket

This class implements basic attributes and methods for Buckets.

Subclasses

Methods

def get(self, key)

Receive KEY as key and return None.

class DummyBucket (profile, args={})

It's a bucket for test purpose use only, use it to make sure that changes didn't break your code. It always returns None for all KEY you try to get a VALUE.

Initialize class using profile name as profile (but it's not used).

Ancestors

Inherited members

class EnvironBucket (profile, args={})

Uses Operating System environment variables to store KEY/VALUE pairs. To set a KEY create an environment variable using the following syntax:

«PROFILE»>__«KEY»=«VALUE»

Where:

  • PROFILE is a name that groups KEYS;
  • KEY is a name to identify a specific VALUE and
  • VALUE is a value itself (dont't care about data types here, for Python it's always a string).

Don't forget that a combinatiom of profile and key must be unique!

Example

A set of variables, just like on Docker Compose .env file:

TEST__HOSTNAME=127.0.0.1
HOMOLOG__HOSTNAME=172.16.20.123
PRODUCTION__HOSTNAME=app.myapplication.com

Here HOSTNAME content is 127.0.0.1 for TEST profile, 172.16.20.123 forHOMOLOG and app.myapplication.com for PRODUCTION.

Initialize class uising profile name as profile.

Ancestors

Methods

def get(self, key_raw)

Retrieve VALUE from a given KEY as key_raw and return it.