Commit b36ba1ed authored by Sebastien's avatar Sebastien

Mode local

parent 50741a3f
FROM ubuntu:16.04
MAINTAINER Sebastien.Carrere@toulouse.inra.fr
MAINTAINER sebastien.carrere@inra.fr
RUN apt-get update && apt-get install -y --no-install-recommends apt-utils
RUN apt-get -q update && \
......
......@@ -9,7 +9,8 @@
<li><a href="#prerequisites">PREREQUISITES</a></li>
<li><a href="#build">BUILD</a></li>
<li><a href="#configure">CONFIGURE</a></li>
<li><a href="#local-configuration">LOCAL CONFIGURATION</a></li>
<li><a href="#standard-configuration">STANDARD CONFIGURATION</a></li>
<li><a href="#create-admin-user">CREATE ADMIN USER</a></li>
<li><a href="#run-app">RUN APP</a></li>
<li><a href="#stop-app">STOP APP</a></li>
......@@ -85,8 +86,16 @@ If you want to create users from host server (not from Docker image), you will n
export FC=$PWD
$FC/build.sh
### LOCAL CONFIGURATION ###
### CONFIGURE ###
Run Family-Companion locally:
* login/password set to guest/guest
* sendmail deactivated
* persistence directory set to $HOME/.family-companion
`$FC/configure.sh --local`
### STANDARD CONFIGURATION ###
#### Persistence directory ####
......
......@@ -78,7 +78,7 @@ MAIN:
my $email = lc($o_param->Get('email'));
if (!IsEmailValid($email))
if ($email ne 'guest' && !IsEmailValid($email))
{
die "[ERROR] - $email is not a valid email address";
}
......@@ -131,8 +131,7 @@ Url: $url
END
$fh_mail->close;
my $ssmtp_conf = "$FindBin::RealBin/../../data/cfg/ssmtp.conf";
$ssmtp_conf = $ENV{'FC_DIR'} . '/data/cfg/ssmtp.conf'
if (defined $ENV{'FC_DIR'} && -e $ENV{'FC_DIR'} . '/data/cfg/ssmtp.conf');
$ssmtp_conf = $ENV{'FC_DIR'} . '/data/cfg/ssmtp.conf' if (defined $ENV{'FC_DIR'} && -e $ENV{'FC_DIR'} . '/data/cfg/ssmtp.conf');
if (-e $ssmtp_conf)
{
......
#!/bin/bash
error=0;
local=0;
echo -e "\e[1m\e[100m";
if [[ $1 == *"local"* ]]; then
echo -e "\e[33m>>>> [HELP] - Local installation: login/password set to guest/guest - Sendmail not activated\nData directory set to $HOME/.family-companion\e[39m";
FC_ADMIN='guest'
FC_SMTP='local'
FC_PORT='1977'
FC_HOSTNAME='localhost'
FC_DIR="$HOME/.family-companion"
mkdir -p $FC_DIR
local=1
fi
if [ -z ${FC_DIR+x} ]
then
......@@ -59,12 +70,12 @@ if [ $error -ne 1 ]
then
if [ ! -d $FC_DIR/data ]
then
mkdir $FC_DIR/data
mkdir -p $FC_DIR/data
chown www-data.www-data $FC_DIR/data
fi
if [ ! -d $FC_DIR/etc ]
then
mkdir $FC_DIR/etc;
mkdir -p $FC_DIR/etc;
chown www-data.www-data $FC_DIR/etc
fi
if [ ! -d $FC_DIR/data/cfg ]
......@@ -118,5 +129,11 @@ cp site/cfg/authentication-docker.cfg site/cfg/authentication.cfg
cp site/cfg/site-docker.cfg site/cfg/site.cfg
chown www-data.www-data $FC_DIR/data/cfg/local.cfg
if [ $local -eq 1 ]
then
./bin/int/admin_addUser.pl --email=$FC_ADMIN --password=guest --common_name='guest' --outdir=$FC_DIR/etc
echo -e "mode=local\n" >> $FC_DIR/data/cfg/local.cfg;
fi
echo -e "\e[49m";
echo -e "\e[0m";
......@@ -28,7 +28,7 @@ sub AdjustConfig
$O_CONF->Update("$rootdir/data/cfg/env.cfg", 'O');
}
if (!IsEmailValid($O_CONF->Get('admin_mail')))
if ($O_CONF->Get('admin_mail') ne 'guest' && !IsEmailValid($O_CONF->Get('admin_mail')))
{
&Die('ERROR - admin_mail is not set - complete site/cfg/site.cfg file ', 'early');
}
......@@ -137,6 +137,12 @@ sub SendMail
{
my ($email, $subject, $body, $cc) = @_;
#Mode local, je desactive le sendmail
if ($O_CONF->Get('mode') eq 'local')
{
return 1;
}
my @a_emails = split(',', $email);
my @a_valid_emails = ();
foreach my $email_test (@a_emails)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment