X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=myslice%2Fconfig.py;h=9cf2407253f7b4881faff2be64c5fb5ffdbb78c3;hb=8face13783b648613e73383371d3558bca9ec322;hp=84a0ee0dcb8ebda33ff1811a3234e4f2dbbfb9c5;hpb=de93a901d06d0f4f666ff0fcafd1fa024da144e1;p=unfold.git diff --git a/myslice/config.py b/myslice/config.py index 84a0ee0d..9cf24072 100644 --- a/myslice/config.py +++ b/myslice/config.py @@ -1,10 +1,38 @@ +import os.path +from ConfigParser import RawConfigParser +from myslice.settings import ROOT + +# as this code suggests, you have the option to write myslice/myslice.ini +# that looks like this +#[manifold] +#url = http://manifold.pl.sophia.inria.fr:7080/ + class Config: -# manifold_server = 'demo.myslice.info' - manifold_server = 'debian04.pl.sophia.inria.fr' - manifold_port = '7080' - manifold_path = '/' + # the OpenLab-wide backend as managed by UPMC + # xxx production should probably use https of course + default_manifold_url = "http://test.myslice.info:7080/" + # the devel/unstable version runs on "http://dev.myslice.info:7080/" + # if you use a development backend running on this box, use "http://localhost:7080/" + # the INRIA setup is with "http://manifold.pl.sophia.inria.fr:7080/" + + _config_parser = None + + # having grown tired of screwing up with git stashes + # taking away my local config, we now more properly use + # an external config file to override teh default + @staticmethod + def manifold_url (): + if Config._config_parser: + return Config._config_parser.get('manifold','url') + config = RawConfigParser () + config.add_section('manifold') + config.set ('manifold', 'url', Config.default_manifold_url) + config.read (os.path.join(ROOT,'myslice/myslice.ini')) + Config._config_parser=config + return Config.manifold_url() + # exporting these details to js @staticmethod - def manifold_url (): - return "http://%s:%s%s"%(Config.manifold_server,Config.manifold_port,Config.manifold_path) + def manifold_js_export (): + return "var MANIFOLD_URL = '%s';\n"%Config.manifold_url();