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
keyand returnNone.
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
Nonefor 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:
PROFILEis a name that groups KEYS;KEYis a name to identify a specific VALUE andVALUEis a value itself (dont't care about data types here, for Python it's always a string).
Don't forget that a combinatiom of
profileandkeymust be unique!Example
A set of variables, just like on Docker Compose
.envfile:TEST__HOSTNAME=127.0.0.1 HOMOLOG__HOSTNAME=172.16.20.123 PRODUCTION__HOSTNAME=app.myapplication.comHere
HOSTNAMEcontent is 127.0.0.1 forTESTprofile, 172.16.20.123 forHOMOLOGand app.myapplication.com forPRODUCTION.Initialize class uising profile name as
profile.Ancestors
Methods
def get(self, key_raw)-
Retrieve VALUE from a given KEY as
key_rawand return it.