Giter Club home page Giter Club logo

Comments (1)

eldipa avatar eldipa commented on July 18, 2024

I think that with a few modifications it can be done (please, correct me if I'm missing something):

First, the server (in the debugger) must choose a random port (tcp) or random domain (unix):

voltron/voltron/core.py

Lines 162 to 171 in 0b7a2fb

if voltron.config.server.listen.tcp:
run_listener('tcp', ThreadedVoltronWSGIServer, list(voltron.config.server.listen.tcp) + [self.app])
if voltron.config.server.listen.domain and sys.platform != 'win32':
path = os.path.expanduser(str(voltron.config.server.listen.domain))
try:
os.unlink(path)
except:
pass
run_listener('domain', ThreadedUnixWSGIServer, [path, self.app])

We could say "if you choose a port == 0 in the configuration, voltron will pick a random one for you". Something similar for the domain like "if the domain ends in a -, voltron will add a random postfix to it".

Then we should let the user know which port/domain was chosen:

print(blessed.Terminal().bold_red("Voltron loaded."))

The client side is a little more complex.

First, we should add a parameter to the views to change the port/domain.

voltron/voltron/view.py

Lines 148 to 153 in 0b7a2fb

def add_generic_arguments(cls, sp):
sp.add_argument('--show-header', '-e', dest="header", action='store_true', help='show header', default=None)
sp.add_argument('--hide-header', '-E', dest="header", action='store_false', help='hide header')
sp.add_argument('--show-footer', '-f', dest="footer", action='store_true', help='show footer', default=None)
sp.add_argument('--hide-footer', '-F', dest="footer", action='store_false', help='hide footer')
sp.add_argument('--name', '-n', action='store', help='named configuration to use', default=None)

Now, the problem is that the client expects the final URL, not an IP+port or a domain:

self.client = Client(url=voltron.config.view.api_url)

The simplest solution (but not human friendly) would create a parameter to change not the port/domain but the api_url and configure the client to use it.

Any thoughts? If there is interest on this I could write a PR.

from voltron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.