Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Config #57

Merged
merged 8 commits into from
Sep 9, 2024
Merged
11 changes: 6 additions & 5 deletions readme-vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# project information
project_name: cops
project_url: "http://blog.slucas.fr/en/oss/calibre-opds-php-server"
project_url: "https://github.com/mikespub-org/seblucas-cops"
project_logo: "https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/cops-icon.png"
project_blurb: |
[{{ project_name|capitalize }}]({{ project_url }}) by Sébastien Lucas, now maintained by MikesPub, stands for Calibre OPDS (and HTML) Php Server.
Expand All @@ -13,7 +13,7 @@ project_blurb: |

See : [COPS's home]({{ project_url }}) for more details.

Don't forget to check the [Wiki](https://github.com/seblucas/cops/wiki).
Don't forget to check the [Wiki](https://github.com/mikespub-org/seblucas-cops/wiki).

## Why? (taken from the author's site)

Expand All @@ -36,7 +36,7 @@ project_blurb: |
* With Dropbox / owncloud it's very easy to have an up to date OPDS server.
* It was fun to code.

If you want to use the OPDS feed don't forget to specify feed.php at the end of your URL.
If you want to use the OPDS feed don't forget to specify /feed at the end of your URL.

project_lsio_github_repo_url: "https://github.com/linuxserver/docker-{{ project_name }}"

Expand All @@ -60,12 +60,13 @@ param_ports:
# application setup block
app_setup_block_enabled: true
app_setup_block: |
Access the webui at `http://<docker host ip>:80`. For connecting via OPDS on a mobile device use `http://<docker host ip>:80/feed.php`. It is strongly suggested that you reverse proxy this prior to exposing to the internet. For more information, such as requiring credentials, check the COPS Wiki (linked above).
Access the webui at `http://<docker host ip>:80`. For connecting via OPDS on a mobile device use `http://<docker host ip>:80/index.php/feed`. It is strongly suggested that you reverse proxy this prior to exposing to the internet. For more information, such as requiring credentials, check the COPS Wiki (linked above).

The linuxserver version gives you access to `config_local.php` in `/config` to customise your install to suit your needs, it also includes the dependencies required to directly view epub books in your browser.
The linuxserver version gives you access to `config/local.php` in `/config` to customise your install to suit your needs, it also includes the dependencies required to directly view epub books in your browser.

# changelog
changelogs:
- { date: "09.09.24:", desc: "In COPS 3.x, the config_local.php is being moved over to config/local.php and this container will automatically migrate it. Existing users should verify: config_local.php and/or config/local.php - define $config['cops_kepubify_path'] if they want to use it" }
- { date: "28.08.24:", desc: "Add kepubify tool to update metadata for Kobo - see mikespub-org/seblucas-cops#77" }
- { date: "24.06.24:", desc: "Rebase to Alpine 3.20. Existing users should update their nginx confs to avoid http2 deprecation warnings." }
- { date: "07.05.24:", desc: "Existing users should verify: site-confs/default.conf - Fix rewriting rules default site conf." }
Expand Down
44 changes: 34 additions & 10 deletions root/defaults/config_local.php → root/defaults/config/local.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,22 @@
*/
$config['cops_use_url_rewriting'] = "0";

/*
/*
* Which header to use when downloading books outside the web directory
* Possible values are :
* X-Accel-Redirect : For Nginx
* X-Sendfile : For Lightttpd or Apache (with mod_xsendfile)
* No value (default) : Let PHP handle the download
*/

$config['cops_x_accel_redirect'] = "X-Accel-Redirect";
$config['cops_x_accel_redirect'] = "X-Accel-Redirect";

/* Enable cache folder
* especially useful for lower power hosts
*/
$config['cops_thumbnail_handling'] = "";
$config['cops_thumbnail_cache_directory'] = "/config/cache/";
$config['cops_thumbnail_handling'] = "";
$config['cops_thumbnail_cache_directory'] = "/config/cache/";

/*
* Enable and configure Send To Kindle (or Email) feature.
*
Expand All @@ -69,10 +71,32 @@
*
* You'll also need to enable Allow Less Secure Apps in you Gmail account.
*/
$config['cops_mail_configuration'] = array( "smtp.host" => "",
"smtp.username" => "",
"smtp.password" => "",
"smtp.secure" => "ssl",
"address.from" => "[email protected]"
);

/*
* Use external 'kepubify' tool to convert .epub files to .kepub.epub format for Kobo
* Example:
* $config['cops_kepubify_path'] = '/usr/bin/kepubify';
*/
//$config['cops_kepubify_path'] = '';
$config['cops_kepubify_path'] = '/usr/bin/kepubify';

/*
* Set front controller to remove index.php/ from route URLs generated in COPS
*
* Note: this assumes your web server config will rewrite /... to /index.php/...
* - Apache: .htaccess
* - Nginx: nginx.conf
* - PHP built-in: router.php
* - ...
*
* @todo update nginx/site-confs/default.conf.sample to make use of front controller
*/
$config['cops_front_controller'] = '';
//$config['cops_front_controller'] = 'index.php';

$config['cops_mail_configuration'] = array( "smtp.host" => "",
"smtp.username" => "",
"smtp.password" => "",
"smtp.secure" => "ssl",
"address.from" => "[email protected]"
);
25 changes: 20 additions & 5 deletions root/etc/s6-overlay/s6-rc.d/init-cops-config/run
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,37 @@
# create folders
mkdir -p \
/config/cache
# create folders (COPS 3.x)
mkdir -p \
/config/config

# clear previous config
# clear previous config (COPS 1.x and 2.x)
for f in /app/www/public/config_local.*.php; do
if [ -f "$f" ]; then
rm "$f"
fi
done
# clear previous config (COPS 3.x)
for f in /app/www/public/config/local.*.php; do
if [ -f "$f" ]; then
rm "$f"
fi
done

# copy config
if [[ ! -e /config/config_local.php ]]; then
cp /defaults/config_local.php /config/config_local.php
if [[ ! -e /config/config/local.php ]]; then
if [[ -e /config/config_local.php ]]; then
echo "**** Existing config found, migrating for v3. Please check the contents of /config/config/local.php which will be the active config in v3 ****"
cp /config/config_local.php /config/config/local.php
else
echo "**** New instance detected, generating default config at /config/config/local.php ****"
cp /defaults/config/local.php /config/config/local.php
fi
fi

# copy extra user-profiles
for f in /config/config_local*.php; do
cp "$f" /app/www/public/
for f in /config/config/local*.php; do
cp "$f" /app/www/public/config/
done

# permissions
Expand Down