Erlang/OTP Forums

Author Message

<  Yaws mailing list  ~  New functions to start in embedded mode

tobbe
Posted: Tue Sep 05, 2006 7:01 am Reply with quote
User Joined: 19 Jan 2005 Posts: 274 Location: Stockholm, Sweden
Hi,

I just added start_embedded/1 and start_embedded/4 to yaws.erl.

A quick and easy way of starting Yaws in embedded mode.
No need for any start-script switches and no dependencies
to Yaws header files. Just call either start_embedded/1
or start_embedded/4 and you are in the air.

yaws:start_embedded(DocRoot).

yaws:start_embedded(DocRoot, Host, Port, Listen).

For start_embedded/1 the following default values will be used:

Host = "localhost"
Port = 8888
Listen = {0,0,0,0}


Cheers, Tobbe


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message Send e-mail Visit poster's website
Guest
Posted: Tue Sep 05, 2006 7:28 am Reply with quote
Guest
Torbjorn Tornkvist wrote:
> Hi,
>
> I just added start_embedded/1 and start_embedded/4 to yaws.erl.
>
> A quick and easy way of starting Yaws in embedded mode.
> No need for any start-script switches and no dependencies
> to Yaws header files. Just call either start_embedded/1
> or start_embedded/4 and you are in the air.
>
> yaws:start_embedded(DocRoot).
>
> yaws:start_embedded(DocRoot, Host, Port, Listen).
>
> For start_embedded/1 the following default values will be used:
>
> Host = "localhost"
> Port = 8888
> Listen = {0,0,0,0}
>
>
> Cheers, Tobbe
>



excellent, make sure you also update the docs

man/yaws.1 and www/embed.yaws


/klacke



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Guest
Posted: Tue Sep 05, 2006 11:53 am Reply with quote
Guest
On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
> Hi,
>
> I just added start_embedded/1 and start_embedded/4 to yaws.erl.
>
> A quick and easy way of starting Yaws in embedded mode.
> No need for any start-script switches and no dependencies
> to Yaws header files. Just call either start_embedded/1
> or start_embedded/4 and you are in the air.
>
> yaws:start_embedded(DocRoot).
>
> yaws:start_embedded(DocRoot, Host, Port, Listen).
>
> For start_embedded/1 the following default values will be used:
>
> Host = "localhost"
> Port = 8888
> Listen = {0,0,0,0}

What about setting up appmods?

-bob

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
tobbe
Posted: Tue Sep 05, 2006 12:00 pm Reply with quote
User Joined: 19 Jan 2005 Posts: 274 Location: Stockholm, Sweden
Bob Ippolito wrote:
> On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
>> Hi,
>>
>> I just added start_embedded/1 and start_embedded/4 to yaws.erl.
>>
>> A quick and easy way of starting Yaws in embedded mode.
>> No need for any start-script switches and no dependencies
>> to Yaws header files. Just call either start_embedded/1
>> or start_embedded/4 and you are in the air.
>>
>> yaws:start_embedded(DocRoot).
>>
>> yaws:start_embedded(DocRoot, Host, Port, Listen).
>>
>> For start_embedded/1 the following default values will be used:
>>
>> Host = "localhost"
>> Port = 8888
>> Listen = {0,0,0,0}
>
> What about setting up appmods?

Hm...perhaps start_embedded/4 should be replaced with a
start_embedded/2 like this:

start_embedded(DocRoot, [{host,Host}, {appmods, Appmods}, etc...]).

and provide reasonable default values where possible.

--Tobbe

>
> -bob
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message Send e-mail Visit poster's website
Guest
Posted: Tue Sep 05, 2006 12:34 pm Reply with quote
Guest
On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
> Bob Ippolito wrote:
> > On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
> >> Hi,
> >>
> >> I just added start_embedded/1 and start_embedded/4 to yaws.erl.
> >>
> >> A quick and easy way of starting Yaws in embedded mode.
> >> No need for any start-script switches and no dependencies
> >> to Yaws header files. Just call either start_embedded/1
> >> or start_embedded/4 and you are in the air.
> >>
> >> yaws:start_embedded(DocRoot).
> >>
> >> yaws:start_embedded(DocRoot, Host, Port, Listen).
> >>
> >> For start_embedded/1 the following default values will be used:
> >>
> >> Host = "localhost"
> >> Port = 8888
> >> Listen = {0,0,0,0}
> >
> > What about setting up appmods?
>
> Hm...perhaps start_embedded/4 should be replaced with a
> start_embedded/2 like this:
>
> start_embedded(DocRoot, [{host,Host}, {appmods, Appmods}, etc...]).
>
> and provide reasonable default values where possible.

That sounds good.. I'm currently using something like this, and it
would be nice to be able to use a cleaner API:

configure({Port, DocRoot, AppMods}) ->
GC = yaws_config:make_default_gconf(false, undefined),
GC2 = GC#gconf{
trace = false,
tmpdir = local_path(["priv", "tmp"])},
GC3 = ?gc_set_auth_log(GC2, false),
GC4 = ?gc_set_copy_errlog(GC3, false),

SC = #sconf{
port = Port,
servername = "localhost",
listen = {127,0,0,1},
docroot = DocRoot,
appmods = AppMods
},
SC2 = ?sc_set_access_log(SC, false),
yaws_api:setconf(GC4, [[SC2]]).

-bob

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
tobbe
Posted: Tue Sep 05, 2006 2:11 pm Reply with quote
User Joined: 19 Jan 2005 Posts: 274 Location: Stockholm, Sweden
Bob Ippolito wrote:
> On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
>> Bob Ippolito wrote:
>>> On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
>>>> Hi,
>>>>
>>>> I just added start_embedded/1 and start_embedded/4 to yaws.erl.
>>>>
>>>> A quick and easy way of starting Yaws in embedded mode.
>>>> No need for any start-script switches and no dependencies
>>>> to Yaws header files. Just call either start_embedded/1
>>>> or start_embedded/4 and you are in the air.
>>>>
>>>> yaws:start_embedded(DocRoot).
>>>>
>>>> yaws:start_embedded(DocRoot, Host, Port, Listen).
>>>>
>>>> For start_embedded/1 the following default values will be used:
>>>>
>>>> Host = "localhost"
>>>> Port = 8888
>>>> Listen = {0,0,0,0}
>>> What about setting up appmods?
>> Hm...perhaps start_embedded/4 should be replaced with a
>> start_embedded/2 like this:
>>
>> start_embedded(DocRoot, [{host,Host}, {appmods, Appmods}, etc...]).
>>
>> and provide reasonable default values where possible.
>
> That sounds good.. I'm currently using something like this, and it
> would be nice to be able to use a cleaner API:

I have added start_embedded/2 which takes a DocRoot and a list
of Key,Value tuples of sconf values. So for example:

start_embedded(DocRoot, [{port,Port},{appmods,AppMods},
{flags, [{access_log, false}]}),

Note the flags keywords which takes a list of boolean
values that will be set on the default flag value.

Also, all default values are now the same as you get
from #sconf{}.

Left to do, to get rid of your example completely, is
to add start_embedded/3 which would also take a list
of gconf values.

Cheers, Tobbe

>
> configure({Port, DocRoot, AppMods}) ->
> GC = yaws_config:make_default_gconf(false, undefined),
> GC2 = GC#gconf{
> trace = false,
> tmpdir = local_path(["priv", "tmp"])},
> GC3 = ?gc_set_auth_log(GC2, false),
> GC4 = ?gc_set_copy_errlog(GC3, false),
>
> SC = #sconf{
> port = Port,
> servername = "localhost",
> listen = {127,0,0,1},
> docroot = DocRoot,
> appmods = AppMods
> },
> SC2 = ?sc_set_access_log(SC, false),
> yaws_api:setconf(GC4, [[SC2]]).
>
> -bob
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message Send e-mail Visit poster's website
anders_n
Posted: Tue Sep 05, 2006 2:37 pm Reply with quote
User Joined: 28 Feb 2005 Posts: 155 Location: Saltillo, Mexico
On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
> Bob Ippolito wrote:
> > On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
> >> Bob Ippolito wrote:
> >>> On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
> >>>> Hi,
> >>>>
> >>>> I just added start_embedded/1 and start_embedded/4 to yaws.erl.
> >>>>
> >>>> A quick and easy way of starting Yaws in embedded mode.
> >>>> No need for any start-script switches and no dependencies
> >>>> to Yaws header files. Just call either start_embedded/1
> >>>> or start_embedded/4 and you are in the air.
> >>>>
> >>>> yaws:start_embedded(DocRoot).
> >>>>
> >>>> yaws:start_embedded(DocRoot, Host, Port, Listen).
> >>>>
> >>>> For start_embedded/1 the following default values will be used:
> >>>>
> >>>> Host = "localhost"
> >>>> Port = 8888
> >>>> Listen = {0,0,0,0}
> >>> What about setting up appmods?
> >> Hm...perhaps start_embedded/4 should be replaced with a
> >> start_embedded/2 like this:
> >>
> >> start_embedded(DocRoot, [{host,Host}, {appmods, Appmods}, etc...]).
> >>
> >> and provide reasonable default values where possible.
> >
> > That sounds good.. I'm currently using something like this, and it
> > would be nice to be able to use a cleaner API:
>
> I have added start_embedded/2 which takes a DocRoot and a list
> of Key,Value tuples of sconf values. So for example:
>
> start_embedded(DocRoot, [{port,Port},{appmods,AppMods},
> {flags, [{access_log, false}]}),
>
> Note the flags keywords which takes a list of boolean
> values that will be set on the default flag value.
>
> Also, all default values are now the same as you get
> from #sconf{}.
>
Tobbe
Is there any special reason that You did not include all the fields in sconf,
e.g. xtra_docroots.

/Anders

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message Yahoo Messenger
tobbe
Posted: Tue Sep 05, 2006 6:35 pm Reply with quote
User Joined: 19 Jan 2005 Posts: 274 Location: Stockholm, Sweden
Anders Nygren wrote:
> On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
>> Bob Ippolito wrote:
>>> On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
>>>> Bob Ippolito wrote:
>>>>> On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
>>>>>> Hi,
>>>>>>
>>>>>> I just added start_embedded/1 and start_embedded/4 to yaws.erl.
>>>>>>
>>>>>> A quick and easy way of starting Yaws in embedded mode.
>>>>>> No need for any start-script switches and no dependencies
>>>>>> to Yaws header files. Just call either start_embedded/1
>>>>>> or start_embedded/4 and you are in the air.
>>>>>>
>>>>>> yaws:start_embedded(DocRoot).
>>>>>>
>>>>>> yaws:start_embedded(DocRoot, Host, Port, Listen).
>>>>>>
>>>>>> For start_embedded/1 the following default values will be used:
>>>>>>
>>>>>> Host = "localhost"
>>>>>> Port = 8888
>>>>>> Listen = {0,0,0,0}
>>>>> What about setting up appmods?
>>>> Hm...perhaps start_embedded/4 should be replaced with a
>>>> start_embedded/2 like this:
>>>>
>>>> start_embedded(DocRoot, [{host,Host}, {appmods, Appmods}, etc...]).
>>>>
>>>> and provide reasonable default values where possible.
>>> That sounds good.. I'm currently using something like this, and it
>>> would be nice to be able to use a cleaner API:
>> I have added start_embedded/2 which takes a DocRoot and a list
>> of Key,Value tuples of sconf values. So for example:
>>
>> start_embedded(DocRoot, [{port,Port},{appmods,AppMods},
>> {flags, [{access_log, false}]}),
>>
>> Note the flags keywords which takes a list of boolean
>> values that will be set on the default flag value.
>>
>> Also, all default values are now the same as you get
>> from #sconf{}.
>>
> Tobbe
> Is there any special reason that You did not include all the fields in sconf,
> e.g. xtra_docroots.

Pure laziness... Smile
Unless someone else do it I will fix it.

--Tobbe

>
> /Anders
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message Send e-mail Visit poster's website
tobbe
Posted: Tue Sep 05, 2006 8:23 pm Reply with quote
User Joined: 19 Jan 2005 Posts: 274 Location: Stockholm, Sweden
> Bob Ippolito wrote:
> That sounds good.. I'm currently using something like this, and it
> would be nice to be able to use a cleaner API:

Ok, I have now committed the 'final' fix for this.
You should now be able to rewrite your code below to:

GL=[{trace,false},{tmpdir,local_path(["priv", "tmp"]),
{flags,[{auth_log,false},{copy_errlog,false}]}],
SL=[{port,Port},{appmods,AppMods},
{flags,[{access_log,false}]}],
yaws:start_embedded{DocRoot, SL, GL).


--Tobbe
(Ps. and embed.yaws is updated too)


> configure({Port, DocRoot, AppMods}) ->
> GC = yaws_config:make_default_gconf(false, undefined),
> GC2 = GC#gconf{
> trace = false,
> tmpdir = local_path(["priv", "tmp"])},
> GC3 = ?gc_set_auth_log(GC2, false),
> GC4 = ?gc_set_copy_errlog(GC3, false),
>
> SC = #sconf{
> port = Port,
> servername = "localhost",
> listen = {127,0,0,1},
> docroot = DocRoot,
> appmods = AppMods
> },
> SC2 = ?sc_set_access_log(SC, false),
> yaws_api:setconf(GC4, [[SC2]]).
>
> -bob
>
> -------------------------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
View user's profile Send private message Send e-mail Visit poster's website
Guest
Posted: Tue Sep 05, 2006 8:28 pm Reply with quote
Guest
On 9/5/06, Torbjorn Tornkvist <tobbe@tornkvist.org> wrote:
> > Bob Ippolito wrote:
> > That sounds good.. I'm currently using something like this, and it
> > would be nice to be able to use a cleaner API:
>
> Ok, I have now committed the 'final' fix for this.
> You should now be able to rewrite your code below to:
>
> GL=[{trace,false},{tmpdir,local_path(["priv", "tmp"]),
> {flags,[{auth_log,false},{copy_errlog,false}]}],
> SL=[{port,Port},{appmods,AppMods},
> {flags,[{access_log,false}]}],
> yaws:start_embedded{DocRoot, SL, GL).

Stupid question, but where is the svn or cvs repository for yaws? I
don't see any obvious links and it doesn't seem to live in the cvs
repo on sourceforge.

-bob

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Guest
Posted: Tue Sep 05, 2006 8:36 pm Reply with quote
Guest
Bob Ippolito wrote:

>
> Stupid question, but where is the svn or cvs repository for yaws? I
> don't see any obvious links and it doesn't seem to live in the cvs
> repo on sourceforge.
>


It CVS lives just fine at

:ext:${USER}@erlyaws.cvs.sourceforge.net:/cvsroot/erlyaws


anon access is also as usual


/klacke


--
Claes Wikstrom -- Caps lock is nowhere and
http://www.tail-f.com -- everything is under control
cellphone: +46 70 2097763

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist
Guest
Posted: Tue Sep 05, 2006 9:38 pm Reply with quote
Guest
On 9/5/06, Claes Wikstrom <klacke@tail-f.com> wrote:
> Bob Ippolito wrote:
>
> >
> > Stupid question, but where is the svn or cvs repository for yaws? I
> > don't see any obvious links and it doesn't seem to live in the cvs
> > repo on sourceforge.
> >
>
>
> It CVS lives just fine at
>
> :ext:${USER}@erlyaws.cvs.sourceforge.net:/cvsroot/erlyaws
>
>
> anon access is also as usual

So it was a stupid question.. for some reason I guessed the
sourceforge project name rather than looking under the build and run
section of the site.

It would've helped me if the download section referenced the CVS
repository. "Build and run" is the last place I would've looked to
find out where to acquire the source.

-bob

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum