Skip to content

Commit

Permalink
add default language in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
tale-fau committed Sep 28, 2023
1 parent abd2b9a commit 2a8b01f
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
6 changes: 0 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,6 @@ RUN apt update && \
docker-php-ext-install gettext && \
rm -rf /var/lib/apt/lists/*

RUN sed -i "/$DEFAULT_LANGUAGE/s/^# //g" /etc/locale.gen && \
locale-gen
ENV LANG $DEFAULT_LANGUAGE
ENV LANGUAGE $DEFAULT_LANGUAGE
ENV LC_ALL $DEFAULT_LANGUAGE

COPY . /usr/local/signaturepdf

RUN envsubst < /usr/local/signaturepdf/config/php.ini > /usr/local/etc/php/conf.d/uploads.ini && \
Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,16 @@ docker run -d --name=signaturepdf -p 8080:80 signaturepdf

The following variables can be used to configure the deployment:

| Variable | description | exemple | defaut |
| ---------------------- |-----------------------------------------------------------------------| -------------------------------- | --------- |
| `SERVERNAME` | Deployment URL | `pdf.24eme.fr` | localhost |
| `UPLOAD_MAX_FILESIZE` | Maximum size of the PDF file to sign | 48M | 24M |
| `POST_MAX_SIZE` | Maximum size of the PDF file to sign | 48M | 24M |
| `MAX_FILE_UPLOADS` | Maximum number of pages in the PDF, here 200 pages + the original PDF | 401 | 201 |
| `PDF_STORAGE_PATH` | Path where uploaded PDF files can be stored | /data | /data |
| `DISABLE_ORGANIZATION` | Disable the Organize route | true | false |
| `PDF_DEMO_LINK` | Show, hide, or change the demo PDF link | false, `link` or `relative path` | true |
| Variable | description | exemple | defaut |
|------------------------|-----------------------------------------------------------------------|----------------------------------|-------------|
| `SERVERNAME` | Deployment URL | `pdf.24eme.fr` | localhost |
| `UPLOAD_MAX_FILESIZE` | Maximum size of the PDF file to sign | 48M | 24M |
| `POST_MAX_SIZE` | Maximum size of the PDF file to sign | 48M | 24M |
| `MAX_FILE_UPLOADS` | Maximum number of pages in the PDF, here 200 pages + the original PDF | 401 | 201 |
| `PDF_STORAGE_PATH` | Path where uploaded PDF files can be stored | /data | /data |
| `DISABLE_ORGANIZATION` | Disable the Organize route | true | false |
| `PDF_DEMO_LINK` | Show, hide, or change the demo PDF link | false, `link` or `relative path` | true |
| `DEFAULT_LANGUAGE` | Default language for the application | en_US.UTF-8 | fr_FR.UTF-8 |

```bash
docker run -d --name=signaturepdf -p 8080:80 -e SERVERNAME=pdf.example.org -e UPLOAD_MAX_FILESIZE=48M -e POST_MAX_SIZE=48M -e MAX_FILE_UPLOADS=401 -e PDF_STORAGE_PATH=/data signaturepdf
Expand Down
2 changes: 1 addition & 1 deletion app.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$f3 = require(__DIR__.'/vendor/fatfree/base.php');

$f3->set('FALLBACK', null);
$f3->language($f3->get('HEADERS')['Accept-Language']);
$f3->language(isset($f3->get('HEADERS')['Accept-Language']) ? $f3->get('HEADERS')['Accept-Language'] : '');

session_start();

Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ envsubst < /usr/local/signaturepdf/config/apache.conf > /etc/apache2/sites-avail
envsubst < /usr/local/signaturepdf/config/php.ini > /usr/local/etc/php/conf.d/uploads.ini
envsubst < /usr/local/signaturepdf/config/config.ini.tpl > /usr/local/signaturepdf/config/config.ini

sed -i "/$DEFAULT_LANGUAGE/s/^# //g" /etc/locale.gen && locale-gen
export LANG=$DEFAULT_LANGUAGE
export LANGUAGE=$DEFAULT_LANGUAGE
export LC_ALL=$DEFAULT_LANGUAGE


if [[ ! -z $PDF_STORAGE_PATH ]] ; then
mkdir -p $PDF_STORAGE_PATH
chown www-data:www-data $PDF_STORAGE_PATH
Expand Down

0 comments on commit 2a8b01f

Please sign in to comment.