Project

General

Profile

Bug #525

standalone config file collisions

Added by Jan Klopper over 12 years ago. Updated over 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
2011-11-28
Due date:
% Done:

100%

Estimated time:
Spent time:

Description

When building 2 standalone uweb servers in 1 folder, they both read the same config file as their path is the same, and there's no way to tell uweb standalone to use a specific config file.

Inside the config file they both read the same [standalone] section, and thus a collision occurs as both will run on the same port/ip making it impossible to run 2 servers from the same folder.

Proposed solutions could be:

  • Read a config file based on the name of server's py file, with failover to the current situation.
  • Allow the user to set a configfile in the calling code.
  • Read a specific section based on the name of the server first, with failvoer for the current situation where [standalone] gets read.

Associated revisions

Revision 106:adc94e112884 (diff)
Added by Elmer de Looff over 12 years ago

Rewrite of the uweb.StartServer routine. This now reads the information from the calling frame and injects the handler function where necessary. This greatly reduces the complexity of setting up a router, at the expense of a little 'magic'. The example router has been altered to reflect the reduced complexity. Additionally, the configuration file is only parsed at server startup and not at every request, this creates changes in the PageMaker, but also the Handler has been changed to return a closure with the necessary configuration set up. This all reduces the amount of arguments that need to explicitly be passed along, and removes a wrapper in SetupServer. Lastly, this introduces the option for StandAloneServer to have a router-specific standalone section. This means two routers can share a config file and have separate ports to run on. This resolves #525.

History

#1 Updated by Elmer de Looff over 12 years ago

  • Status changed from New to Resolved
  • Assignee changed from Elmer de Looff to Jan Klopper
  • % Done changed from 0 to 70

This has been fixed in r3098.

For a pair of routers called first.py and second.py, create the following configuration file:

[standalone:first]
port = 8001

[standalone:second]
port = 8002

The StandAloneServer has been changed so that the most specific configuration block will be used. The basename of the router can be used to indicate a standalone config used only for that router. In the example above, the basenames for the routers are 'first' and 'second' respectively, which get their specific configurations from the shared config file.

#2 Updated by Jan Klopper over 12 years ago

  • Status changed from Resolved to Closed
  • % Done changed from 70 to 100

works

Also available in: Atom PDF