Config file and data dir (with BaseXServer in Java)

Sunday, 24 March 2013 · 9 messages · last reply 25 Mar 2013
FG
Florent Georges24 Mar 2013 20:15 #
Hi, When I start a BaseXServer in Java, it creates a config file ~/.basex and a data directory ~/BaseXData. Is there any way to ask BaseX not to create the config file, and to use a specific another data directory? Or at least to tell it where to look for the config file (instead of going to ~/.basex)? I couldn't find either in the documentation. Regards,
KS
Kendall Shaw24 Mar 2013 21:51 #
Quoted text · Florent Georges · 11 lines
On 03/24/2013 12:15 PM, Florent Georges wrote: > Hi, > > When I start a BaseXServer in Java, it creates a config file > ~/.basex and a data directory ~/BaseXData. Is there any way to > ask BaseX not to create the config file, and to use a specific > another data directory? > > Or at least to tell it where to look for the config file > (instead of going to ~/.basex)? I couldn't find either in the > documentation.
If you look at org.basex.test.SandboxTest.java you can see the location of the data directory being specified. BaseXServer has a constructor that takes a Context. Presumably, you could use a context initialized as it is in SandboxTest to change the location. So far, I am using LocalSession and the data directory is created where I specify, and ~/.basex and ~/BaseXData are not created. Kendall
CG
Christian Grünin reply to Florent Georges, 24 Mar 2013, 20:1525 Mar 2013 10:18 #
Hi Florent, thanks Kendall, you can explicitly speciy a BaseX home directory via the "org.basex.path" system property, or place a .basex file in the directory you are starting BaseX from (i.e., in the “current working directory”). You’ll find some information on the page “Configuration” in our Wiki [1], which hopefully includes all relevant information. If something is missing, feel free to ask again. Best, Christian [1] http://docs.basex.org/wiki/Configuration
Quoted text · Florent Georges · 24 lines
On Sun, Mar 24, 2013 at 8:15 PM, Florent Georges <lists at fgeorges.org> wrote: > Hi, > > When I start a BaseXServer in Java, it creates a config file > ~/.basex and a data directory ~/BaseXData. Is there any way to > ask BaseX not to create the config file, and to use a specific > another data directory? > > Or at least to tell it where to look for the config file > (instead of going to ~/.basex)? I couldn't find either in the > documentation. > > Regards, > > > -- > > Florent Georges > http://fgeorges.org/ > http://h2oconsulting.be/ > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
FG
Florent Georges25 Mar 2013 12:46 #
Hi Christian, thanks Kendall, The org.basex.path property is indeed doing the job here. Thanks! One thing I noticed though (and it is not specific to Java, but related to calling the server and client from the command line), is that when using a new home directory (containing no .basex file), the server will always write PORT = 1984, even when passed the option -p12345: # variables home=pwd/basex-home jar=/Library/Java/org/basex/basex-7.6.jar prop=-Dorg.basex.path=$home class=org.basex.BaseXServer # create a new dir mkdir $home # start and stop the server java -cp $jar $prop $class -p12345 & sleep 2 java -cp $jar $prop $class -p12345 stop # look into .basex grep PORT $home/.basex The last command return the following, showing the default values: PORT = 1984 SERVERPORT = 1984 EVENTPORT = 1985 PROXYPORT = 80 STOPPORT = 8985 Shouldn't it save the port number passed on the command line? Regards,
Quoted text · Christian Grün · 43 lines
On 25 mars 2013 10h18, Christian Grün wrote: > > Hi Florent, thanks Kendall, > > you can explicitly speciy a BaseX home directory via the > "org.basex.path" system property, or place a .basex file in the > directory you are starting BaseX from (i.e., in the “current working > directory”). You’ll find some information on the page “Configuration” > in our Wiki [1], which hopefully includes all relevant information. If > something is missing, feel free to ask again. > > Best, > Christian > > [1] http://docs.basex.org/wiki/Configuration > ___________________________ > > On Sun, Mar 24, 2013 at 8:15 PM, Florent Georges <lists at fgeorges.org> > wrote: >> Hi, >> >> When I start a BaseXServer in Java, it creates a config file >> ~/.basex and a data directory ~/BaseXData. Is there any way to >> ask BaseX not to create the config file, and to use a specific >> another data directory? >> >> Or at least to tell it where to look for the config file >> (instead of going to ~/.basex)? I couldn't find either in the >> documentation. >> >> Regards, >> >> >> -- >> >> Florent Georges >> http://fgeorges.org/ >> http://h2oconsulting.be/ >> _______________________________________________ >> BaseX-Talk mailing list >> BaseX-Talk at mailman.uni-konstanz.de >> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
CG
Christian Grün25 Mar 2013 14:11 #
Hi Florent, please note that the existing .basex configuration file will never be overwritten, except for the case that some options are invalid (which may occur when new options are added in a new version of BaseX. Best, Christian
Quoted text · Florent Georges · 88 lines
On Mon, Mar 25, 2013 at 12:46 PM, Florent Georges <lists at fgeorges.org> wrote: > Hi Christian, thanks Kendall, > > The org.basex.path property is indeed doing the job here. Thanks! > > One thing I noticed though (and it is not specific to Java, but related to calling the server and client from the command line), is that when using a new home directory (containing no .basex file), the server will always write PORT = 1984, even when passed the option -p12345: > > # variables > home=`pwd`/basex-home > jar=/Library/Java/org/basex/basex-7.6.jar > prop=-Dorg.basex.path=$home > class=org.basex.BaseXServer > > # create a new dir > mkdir $home > > # start and stop the server > java -cp $jar $prop $class -p12345 & > sleep 2 > java -cp $jar $prop $class -p12345 stop > > # look into .basex > grep PORT $home/.basex > > The last command return the following, showing the default > values: > > PORT = 1984 > SERVERPORT = 1984 > EVENTPORT = 1985 > PROXYPORT = 80 > STOPPORT = 8985 > > Shouldn't it save the port number passed on the command line? > > Regards, > > -- > > Florent Georges > http://fgeorges.org/ > http://h2oconsulting.be/ > > > > On 25 mars 2013 10h18, Christian Grün wrote: >> >> Hi Florent, thanks Kendall, >> >> you can explicitly speciy a BaseX home directory via the >> "org.basex.path" system property, or place a .basex file in the >> directory you are starting BaseX from (i.e., in the “current working >> directory”). You’ll find some information on the page “Configuration” >> in our Wiki [1], which hopefully includes all relevant information. If >> something is missing, feel free to ask again. >> >> Best, >> Christian >> >> [1] http://docs.basex.org/wiki/Configuration >> ___________________________ >> >> On Sun, Mar 24, 2013 at 8:15 PM, Florent Georges <lists at fgeorges.org> >> wrote: >>> Hi, >>> >>> When I start a BaseXServer in Java, it creates a config file >>> ~/.basex and a data directory ~/BaseXData. Is there any way to >>> ask BaseX not to create the config file, and to use a specific >>> another data directory? >>> >>> Or at least to tell it where to look for the config file >>> (instead of going to ~/.basex)? I couldn't find either in the >>> documentation. >>> >>> Regards, >>> >>> >>> -- >>> >>> Florent Georges >>> http://fgeorges.org/ >>> http://h2oconsulting.be/ >>> _______________________________________________ >>> BaseX-Talk mailing list >>> BaseX-Talk at mailman.uni-konstanz.de >>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>
FG
Florent Georges25 Mar 2013 14:31 #
That makes perfect sense indeed. But here the directory itself does not exist, I create it then start and stop the server with the newly create home dir and the overriden port numbers. Since the .basex file is created, I would expect it to contain the overriden values, but that might be just me. Regards,
Quoted text · Christian Grün · 106 lines
> On Lundi 25 mars 2013 14h11, Christian Grün wrote: > Hi Florent, > > please note that the existing .basex configuration file will never be > overwritten, except for the case that some options are invalid (which > may occur when new options are added in a new version of BaseX. > > Best, > Christian > ___________________________ > > On Mon, Mar 25, 2013 at 12:46 PM, Florent Georges <lists at fgeorges.org> > wrote: >> Hi Christian, thanks Kendall, >> >> The org.basex.path property is indeed doing the job here. Thanks! >> >> One thing I noticed though (and it is not specific to Java, but related > to calling the server and client from the command line), is that when using a > new home directory (containing no .basex file), the server will always write > PORT = 1984, even when passed the option -p12345: >> >> # variables >> home=`pwd`/basex-home >> jar=/Library/Java/org/basex/basex-7.6.jar >> prop=-Dorg.basex.path=$home >> class=org.basex.BaseXServer >> >> # create a new dir >> mkdir $home >> >> # start and stop the server >> java -cp $jar $prop $class -p12345 & >> sleep 2 >> java -cp $jar $prop $class -p12345 stop >> >> # look into .basex >> grep PORT $home/.basex >> >> The last command return the following, showing the default >> values: >> >> PORT = 1984 >> SERVERPORT = 1984 >> EVENTPORT = 1985 >> PROXYPORT = 80 >> STOPPORT = 8985 >> >> Shouldn't it save the port number passed on the command line? >> >> Regards, >> >> -- >> >> Florent Georges >> http://fgeorges.org/ >> http://h2oconsulting.be/ >> >> >> >> On 25 mars 2013 10h18, Christian Grün wrote: >>> >>> Hi Florent, thanks Kendall, >>> >>> you can explicitly speciy a BaseX home directory via the >>> "org.basex.path" system property, or place a .basex file in > the >>> directory you are starting BaseX from (i.e., in the “current working >>> directory”). You’ll find some information on the page “Configuration” >>> in our Wiki [1], which hopefully includes all relevant information. If >>> something is missing, feel free to ask again. >>> >>> Best, >>> Christian >>> >>> [1] http://docs.basex.org/wiki/Configuration >>> ___________________________ >>> >>> On Sun, Mar 24, 2013 at 8:15 PM, Florent Georges > <lists at fgeorges.org> >>> wrote: >>>> Hi, >>>> >>>> When I start a BaseXServer in Java, it creates a config file >>>> ~/.basex and a data directory ~/BaseXData. Is there any way to >>>> ask BaseX not to create the config file, and to use a specific >>>> another data directory? >>>> >>>> Or at least to tell it where to look for the config file >>>> (instead of going to ~/.basex)? I couldn't find either in the >>>> documentation. >>>> >>>> Regards, >>>> >>>> >>>> -- >>>> >>>> Florent Georges >>>> http://fgeorges.org/ >>>> http://h2oconsulting.be/ >>>> _______________________________________________ >>>> BaseX-Talk mailing list >>>> BaseX-Talk at mailman.uni-konstanz.de >>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>> >
CG
Christian Grün25 Mar 2013 14:36 #
In this case, you can specify the hidden -W flag (if I remember correctly, though, it’s only available for org.basex.Base).
Quoted text · Florent Georges · 122 lines
On Mon, Mar 25, 2013 at 2:31 PM, Florent Georges <lists at fgeorges.org> wrote: > That makes perfect sense indeed. > > But here the directory itself does not exist, I create it then start and stop the server with the newly create home dir and the overriden port numbers. Since the .basex file is created, I would expect it to contain the overriden values, but that might be just me. > > Regards, > > > -- > > Florent Georges > http://fgeorges.org/ > http://h2oconsulting.be/ > > > >> On Lundi 25 mars 2013 14h11, Christian Grün wrote: >> Hi Florent, >> >> please note that the existing .basex configuration file will never be >> overwritten, except for the case that some options are invalid (which >> may occur when new options are added in a new version of BaseX. >> >> Best, >> Christian >> ___________________________ >> >> On Mon, Mar 25, 2013 at 12:46 PM, Florent Georges <lists at fgeorges.org> >> wrote: >>> Hi Christian, thanks Kendall, >>> >>> The org.basex.path property is indeed doing the job here. Thanks! >>> >>> One thing I noticed though (and it is not specific to Java, but related >> to calling the server and client from the command line), is that when using a >> new home directory (containing no .basex file), the server will always write >> PORT = 1984, even when passed the option -p12345: >>> >>> # variables >>> home=`pwd`/basex-home >>> jar=/Library/Java/org/basex/basex-7.6.jar >>> prop=-Dorg.basex.path=$home >>> class=org.basex.BaseXServer >>> >>> # create a new dir >>> mkdir $home >>> >>> # start and stop the server >>> java -cp $jar $prop $class -p12345 & >>> sleep 2 >>> java -cp $jar $prop $class -p12345 stop >>> >>> # look into .basex >>> grep PORT $home/.basex >>> >>> The last command return the following, showing the default >>> values: >>> >>> PORT = 1984 >>> SERVERPORT = 1984 >>> EVENTPORT = 1985 >>> PROXYPORT = 80 >>> STOPPORT = 8985 >>> >>> Shouldn't it save the port number passed on the command line? >>> >>> Regards, >>> >>> -- >>> >>> Florent Georges >>> http://fgeorges.org/ >>> http://h2oconsulting.be/ >>> >>> >>> >>> On 25 mars 2013 10h18, Christian Grün wrote: >>>> >>>> Hi Florent, thanks Kendall, >>>> >>>> you can explicitly speciy a BaseX home directory via the >>>> "org.basex.path" system property, or place a .basex file in >> the >>>> directory you are starting BaseX from (i.e., in the “current working >>>> directory”). You’ll find some information on the page “Configuration” >>>> in our Wiki [1], which hopefully includes all relevant information. If >>>> something is missing, feel free to ask again. >>>> >>>> Best, >>>> Christian >>>> >>>> [1] http://docs.basex.org/wiki/Configuration >>>> ___________________________ >>>> >>>> On Sun, Mar 24, 2013 at 8:15 PM, Florent Georges >> <lists at fgeorges.org> >>>> wrote: >>>>> Hi, >>>>> >>>>> When I start a BaseXServer in Java, it creates a config file >>>>> ~/.basex and a data directory ~/BaseXData. Is there any way to >>>>> ask BaseX not to create the config file, and to use a specific >>>>> another data directory? >>>>> >>>>> Or at least to tell it where to look for the config file >>>>> (instead of going to ~/.basex)? I couldn't find either in the >>>>> documentation. >>>>> >>>>> Regards, >>>>> >>>>> >>>>> -- >>>>> >>>>> Florent Georges >>>>> http://fgeorges.org/ >>>>> http://h2oconsulting.be/ >>>>> _______________________________________________ >>>>> BaseX-Talk mailing list >>>>> BaseX-Talk at mailman.uni-konstanz.de >>>>> https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >>>> >>
CG
Christian Grünin reply to Liam R E Quin, 25 Mar 2013, 15:4925 Mar 2013 14:56 #
Quoted text · Liam R E Quin · 6 lines
> The caution is that if you upgrade to a newer BaseX version, presumably > in a new directory, your password and port will get reset to defaults, > opening up your site for remote access! The default from a security > perspective should obviously be that BaseX listens only on "localhost" > and no other network interface, or doesn't listen to any port at all, > without a configuration, but I don't think it is shipped that way.
True; if you want to adopt users and passwords from another BaseX installation, you’ll also have to copy the .basexperm file. Christian
LQ
Liam R E Quinin reply to Christian Grün, 25 Mar 2013, 10:1825 Mar 2013 15:49 #
Quoted text · Christian Grün · 4 lines
On Mon, 2013-03-25 at 10:18 +0100, Christian Grün wrote: > [...] or place a .basex file in the > directory you are starting BaseX from (i.e., in the “current working > directory”).
Use extreme caution if you do this. Ideally the two files - ~/.basex and .basex - would be merged, both would be used. The caution is that if you upgrade to a newer BaseX version, presumably in a new directory, your password and port will get reset to defaults, opening up your site for remote access! The default from a security perspective should obviously be that BaseX listens only on "localhost" and no other network interface, or doesn't listen to any port at all, without a configuration, but I don't think it is shipped that way. Liam
-- Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/ Pictures from old books: http://fromoldbooks.org/ Ankh: irc.sorcery.net irc.gnome.org freenode/#xml

⚡Generated with XQuery