#2399 IP address for afBedSheet

shturman Sun 8 Mar 2015

How bind ip address to BedSheet server? I need something like WispService { addr := IpAddr("169.200.3.103") }

SlimerDude Sun 8 Mar 2015

Hi, BedSheet is a WebMod that runs on wisp - see Wisp Integration for more details. But in short you should be able to do this:

bob := BedSheetBuilder(AppModule#.qname)
mod := BedSheetWebMod(bob)

WispService { 
  it.addr = IpAddr("169.200.3.103")
  it.port = 8069
  it.root = mod
}.install.start

(Example uses BedSheet 1.4.8)

shturman Sun 8 Mar 2015

I try to use BedSheetBuilder and run Example.fan from Quick Start but get error: Unknown method e_0::Example.BedSheetBuilder What's wrong?

SlimerDude Sun 8 Mar 2015

BedSheetBuilder is part of BedSheet v1.4.8 which was only released today - ensure you're up to date by running:

C:\> fanr install -r http://repo.status302.com/fanr/ "afBedSheet 1.4.8"

shturman Sun 8 Mar 2015

Ahhh, i don't see ".8"! Ok, i upgrade BedSheet - Example.fan from Quick Start run fine! But in this modification:

using afIoc using afBedSheet using wisp using webmod using inet

class HelloPage {

Text hello(Str name, Int iq := 666) {
    return Text.fromPlain("Hello! I'm $name and I have an IQ of $iq!")
}

}

class AppModule {

@Contribute { serviceType=Routes# }
static Void contributeRoutes(Configuration conf) {
    conf.add(Route(`/index`, Text.fromHtml("<html><body>Welcome to BedSheet!</body></html>")))
    conf.add(Route(`/hello/**`, HelloPage#hello))
}

}

class Example {

Void main() {
    bob := BedSheetBuilder(AppModule#.qname)

mod := BedSheetWebMod(bob)

WispService {

it.addr = IpAddr("192.168.1.12") //my local ip
it.port = 8080
it.root = mod

}.install.start

}

}

fan Example.fan -env development ... ... [afBedSheet] Starting Bed App 'Example_0' on port 0 [web] WispService started on port 8080 ... Bed App 'Example_0' listening on http://localhost:0/

Why different ports? And no connection to 192.168.1.12:8080

shturman Sun 8 Mar 2015

I add port 8080

bob := BedSheetBuilder(AppModule#.qname){port=8080}

and

Actor.sleep(Duration.maxVal)

It's work! )

SlimerDude Mon 9 Mar 2015

Hurray! :)

By the way, why do you need to bind a non-localhost IP address?

shturman Mon 9 Mar 2015

I play with OpenShift DIY cartridge: "The application is required to bind to $OPENSHIFT_DIY_IP:$OPENSHIFT_DIY_PORT" http://developers.openshift.com/en/diy-overview.html

SlimerDude Mon 9 Mar 2015

Wow, that's cool - I know @jcriquet was interested in OpenShift too!

Login or Signup to reply.