Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't mutate the config; load it instead #19

Open
goodboy opened this issue Sep 25, 2017 · 0 comments
Open

Don't mutate the config; load it instead #19

goodboy opened this issue Sep 25, 2017 · 0 comments

Comments

@goodboy
Copy link
Member

goodboy commented Sep 25, 2017

Issue by tgoodlet
Wednesday Apr 12, 2017 at 03:58 GMT
Originally opened as sangoma/sandswitches#15


@vodik made some good suggestions in #9:

I agree, as I see it, I could, in theory define a profile that's completely detached from sandswitches, and then push it:

myprofile = make_me_a_profile()

confmng.sofia.profiles['external'] = myprofile # In theory, at least

So what does myprofile do if you did api calls on it then?

I would suggest a slightly different API:

fs = manage('myfshost.com', keyfile='mykey.rsa')

# Deal with configuration explicitly:
config = fs.config()
# ... do stuff with config
fs.load(config)

And that leaves fs to directly expose API:

fs.sofia.restart_profile(myprofile.name)

Just off-the-cuff ideas.

I followed up with some questions:

Also what about the idea of a config per section? Say,

sofia_confg = confmng.sofia.config()
dir_conf = confmng.directory.config()

sofia_conf['profiles']['internal']['settings']['sip-port']  = '9999'
dir_conf['default']['groups']['default']['users']['myuser'] = {
    'params': {           
        'password': pw,   
        'vm-password': pw,
    }
}             
confmng.sofia.load(sofia_conf)
confmng.directory.load(dir_conf)

It means letting the user deal with smaller more manageable piece-wise config data structures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant