Start a new topic

Add environment identifier to component state object

I commonly use databases, and when we are testing a component on multiple environments (*.city, staging, dev, etc.), I would like to be able to make a component self aware to use a different database to prevent mutation of a prod database for dev testing.


something to the effect of allowing:

 

def handler(state):
    if state.api.env == 'prod':
        database.connect('database')
    elif state.api.env == 'staging':
        database.connect('database_staging')
    else:
        raise Exception("I don't know this env, please help.")

    pass

 




On further thought, it might be a better fit for this to be a system level outevent that I can wire into my component if I choose to build and support an inevent for it.

Frank, 


Thanks for the idea. We've created a ticket and added it to our log of feature requests!

Login to post a comment