Skip to content
This repository has been archived by the owner on Apr 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #24 from Coosos/feature-update-flood
Browse files Browse the repository at this point in the history
Update to the last flood version (4.1.2) and optimize start speed
  • Loading branch information
Wonderfall authored Nov 23, 2020
2 parents 153a284 + a6ad2aa commit 02122e6
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ FROM alpine:3.12
ARG RTORRENT_VER=0.9.8
ARG LIBTORRENT_VER=0.13.8
ARG MEDIAINFO_VER=20.09
ARG FLOOD_VER=4.0.2
ARG FLOOD_VER=4.1.2
ARG BUILD_CORES

ENV UID=991 GID=991 \
FLOOD_SECRET=supersecret \
FLOOD_SECRET=supersecret30charactersminimum \
WEBROOT=/ \
DISABLE_AUTH=false \
RTORRENT_SOCK=true \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#### Environment variables
- **UID** : user id (default : 991)
- **GID** : group id (defaut : 991)
- **FLOOD_SECRET** : flood secret key (defaut : mysupersecretkey) (CHANGE IT)
- **FLOOD_SECRET** : flood secret key (defaut : supersecret30charactersminimum) (CHANGE IT)
- **WEBROOT** : context path (base_URI) (default : /)
- **RTORRENT_SOCK** : true or false (default : true, if false rtorrent listens on 0.0.0.0:5000)
- **PKG_CONFIG_PATH** : `/usr/local/lib/pkgconfig` (don't touch)
Expand Down
33 changes: 24 additions & 9 deletions rootfs/usr/flood/config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
let connectionSettings = {
client: 'rTorrent',
version: 1,
};

if (process.env.RTORRENT_SOCK === 'true' || process.env.RTORRENT_SOCK === true) {
Object.assign(connectionSettings, {
type: 'socket',
socket: '/tmp/rtorrent.sock',
});
} else {
Object.assign(connectionSettings, {
type: 'tcp',
host: process.env.RTORRENT_SCGI_HOST || 'localhost',
port: process.env.RTORRENT_SCGI_PORT || 5000,
});
}

const CONFIG = {
baseURI: process.env.WEBROOT || '/',
dbCleanInterval: 1000 * 60 * 60,
dbPath: '/flood-db/',
tempPath: '/tmp/',
authMethod: process.env.DISABLE_AUTH === 'true' || process.env.DISABLE_AUTH === true ? 'none' : 'default',
floodServerHost: '0.0.0.0',
floodServerPort: 3000,
maxHistoryStates: 30,
pollInterval: 1000 * 5,
secret: process.env.FLOOD_SECRET || 'secret',
disableUsersAndAuth: process.env.DISABLE_AUTH === 'true' || process.env.DISABLE_AUTH === true,
configUser: {
host: process.env.RTORRENT_SCGI_HOST || 'localhost',
port: process.env.RTORRENT_SCGI_PORT || 5000,
socket: process.env.RTORRENT_SOCK === 'true' || process.env.RTORRENT_SOCK === true,
socketPath: '/tmp/rtorrent.sock',
},
torrentClientPollInterval: 1000 * 5,
torrentClientPollIntervalIdle: 1000 * 60 * 15,
secret: process.env.FLOOD_SECRET || 'supersecret30charactersminimum',
configUser: connectionSettings
};

module.exports = CONFIG;
2 changes: 1 addition & 1 deletion rootfs/usr/local/bin/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ mkdir -p /data/.session

rm -f /data/.session/rtorrent.lock

chown -R $UID:$GID /data /home/torrent /tmp /usr/flood /flood-db /etc/s6.d
chown -R $UID:$GID /data /home/torrent /tmp /usr/flood/dist /flood-db /etc/s6.d

if [ ${RTORRENT_SOCK} = "false" ]; then
sed -i -e 's|^scgi_local.*$|scgi_port = 0.0.0.0:5000|' /home/torrent/.rtorrent.rc
Expand Down

0 comments on commit 02122e6

Please sign in to comment.