updated dockerfiles aka. removed all configurable user credentials

This commit is contained in:
knoxfighter 2021-01-14 18:56:24 +01:00
parent f3f4d76e18
commit 7e9864cc69
7 changed files with 7 additions and 34 deletions

View File

@ -1,5 +1,3 @@
ADMIN_USER=admin
ADMIN_PASS=factorio
RCON_PASS=
COOKIE_ENCRYPTION_KEY=
DOMAIN_NAME=<YOUR DOMAIN NAME>

View File

@ -3,10 +3,7 @@ FROM frolvlad/alpine-glibc
ENV FACTORIO_VERSION=stable \
MANAGER_VERSION=0.9.0 \
ADMIN_USER=admin \
ADMIN_PASS=factorio \
RCON_PASS="" \
COOKIE_ENCRYPTION_KEY=""
RCON_PASS=""
VOLUME /opt/fsm-data /opt/factorio/saves /opt/factorio/mods /opt/factorio/config

View File

@ -2,10 +2,7 @@
FROM frolvlad/alpine-glibc
ENV FACTORIO_VERSION=latest \
ADMIN_USER=admin \
ADMIN_PASS=factorio \
RCON_PASS="" \
COOKIE_ENCRYPTION_KEY=""
RCON_PASS=""
VOLUME /opt/fsm-data /opt/factorio/saves /opt/factorio/mods /opt/factorio/config

View File

@ -6,10 +6,7 @@ services:
restart: "unless-stopped"
environment:
- "FACTORIO_VERSION=latest"
- "ADMIN_USER"
- "ADMIN_PASS"
- "RCON_PASS"
- "COOKIE_ENCRYPTION_KEY"
ports:
- "80:80"
- "34197:34197/udp"

View File

@ -6,10 +6,7 @@ services:
restart: "unless-stopped"
environment:
- "FACTORIO_VERSION=latest"
- "ADMIN_USER"
- "ADMIN_PASS"
- "RCON_PASS"
- "COOKIE_ENCRYPTION_KEY"
volumes:
- "./fsm-data:/opt/fsm-data"
- "./factorio-data/saves:/opt/factorio/saves"

View File

@ -3,28 +3,13 @@
init_config() {
jq_cmd='.'
if [ -n $ADMIN_USER ]; then
jq_cmd="${jq_cmd} | .username = \"$ADMIN_USER\""
echo "Admin username is '$ADMIN_USER'"
fi
if [ -n $ADMIN_PASS ]; then
jq_cmd="${jq_cmd} | .password = \"$ADMIN_PASS\""
echo "Admin password is '$ADMIN_PASS'"
fi
echo "IMPORTANT! Please create new user and delete default admin user ASAP."
if [ -z $RCON_PASS ]; then
RCON_PASS="$(random_pass)"
fi
jq_cmd="${jq_cmd} | .rcon_pass = \"$RCON_PASS\""
echo "Factorio rcon password is '$RCON_PASS'"
if [ -z $COOKIE_ENCRYPTION_KEY ]; then
COOKIE_ENCRYPTION_KEY="$(random_pass)"
fi
jq_cmd="${jq_cmd} | .cookie_encryption_key = \"$COOKIE_ENCRYPTION_KEY\""
jq_cmd="${jq_cmd} | .database_file = \"/opt/fsm-data/auth.leveldb\""
jq_cmd="${jq_cmd} | .sq_lite_database_file = \"/opt/fsm-data/sqlite.db\""
jq_cmd="${jq_cmd} | .log_file = \"/opt/fsm-data/factorio-server-manager.log\""
jq "${jq_cmd}" /opt/fsm/conf.json >/opt/fsm-data/conf.json
@ -47,5 +32,5 @@ fi
install_game
cd /opt/fsm && ./factorio-server-manager --conf /opt/fsm-data/conf.json --dir /opt/factorio -port 80
cd /opt/fsm && ./factorio-server-manager --conf /opt/fsm-data/conf.json --dir /opt/factorio --port 80

View File

@ -109,7 +109,9 @@ func (config *Config) updateConfigFile() {
if conf.DatabaseFile != "" {
// Migrate leveldb to sqlite
// set new db name
conf.SQLiteDatabaseFile = "sqlite.db"
// just rename the file from the old path
dbFileDir := filepath.Dir(conf.DatabaseFile)
conf.SQLiteDatabaseFile = filepath.Join(dbFileDir, "sqlite.db")
MigrateLevelDBToSqlite(conf.DatabaseFile, conf.SQLiteDatabaseFile)