Starting multiple sites

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Starting multiple sites

Dirk Verleysen-2
Starting multiple sites as promised.

I have an ini-file which has a section for each site. This file contains the info that may be different depending on the machine I'm on.


Each site has a class (subclass of AbstractSite) to start the site. I'll discuss the SKHerdersemSite here. I rarely have this but these are all class methods.

    | ini |
    DatabaseManager reset: self sitename.
    "self sitename returns 'SKH'. It's the internal identifier of the site. The DatabaseManager is used for my GLORP descriptors, and I want to be sure that there is nothing left if I need to restart the site"
    self tableDefinitionClass setUp. "GLORP initializations are done here"
    self isRunning "isRunning is a class variable from AbstractSite that is set once that SwazooServer is running, so it's only started once"
            [Swazoo.SwazooServer start.
            self isRunning: true].
    ini := DatabaseManager readIni: self sitename. "the ini-file is read into an object"
    (Swazoo.SwazooServer singleton siteNamed: ini websiteName) isNil
        ifTrue: [self createAIDASite: ini].
    "if the site is not known within SwazooServer then it's created using the info from the ini file"
    (AIDASite named: ini websiteName) urlResolver defaultURL: self root
        forObject: self portalClass new.
    "setting the default URL for the site. root is here a simple '/' and the portalClass is the class that will generate the initial page."
    (AIDASite named: ini websiteName)
        styleClass: self styleSheet;
        style: nil.
    "setting and initializing the stylesheet class"
    (AIDASite named: ini websiteName) initFavicon. "setting the favorite icon"
    (AIDASite named: ini websiteName) urlResolver
        defaultURL: self root , '/safe.html'
        forObject: (AIDASite named: devets websiteName) securityManager.
    "initialize the URL for the securityManager"
    self hookAdditionalUrlHook: ini.
    "this hook can be used to initialize additional URL for a specific site, I pass in the ini file content since it might have usefull info (sitename)"
    (AIDASite named: ini websiteName) addAlias: (AIDA.SiteIdentifier
                host: ini aliasHost
                ip: ini aliasIp
                port: ini aliasPort).
    "setup of an alias. When I used dyndns I couldn't connect to my dyndns from my own network and I needed to setup an alias. This is not really required."
    (AIDASite named: ini websiteName) start. "start the site"
    self setSecurity "setting the security, still very basic but waiting for improvements of AIDA on this part"


Dirk Verleysen

Rijgerstraat 58 · 9310 Moorsel · Belgium
Phone +32 53 21 15 10 · Mobile +32 477 26 09 93

Aida mailing list
[hidden email]