Skip to content

Commit

Permalink
Clean up unused/untraversed steps during server startup (#2088)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicomiguelino authored Oct 10, 2024
1 parent f7b981d commit e3cfeb1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
11 changes: 0 additions & 11 deletions bin/start_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ cp -n /usr/src/app/ansible/roles/screenly/files/screenly.conf /data/.screenly/sc
cp -n /usr/src/app/ansible/roles/screenly/files/default_assets.yml /data/.screenly/default_assets.yml
cp -n /usr/src/app/ansible/roles/screenly/files/screenly.db /data/.screenly/screenly.db

if [ -n "${OVERWRITE_CONFIG}" ]; then
echo "Requested to overwrite Anthias config file."
cp /usr/src/app/ansible/roles/screenly/files/screenly.conf "/data/.screenly/screenly.conf"
fi

# Set management page's user and password from environment variables,
# but only if both of them are provided. Can have empty values provided.
if [ -n "${MANAGEMENT_USER+x}" ] && [ -n "${MANAGEMENT_PASSWORD+x}" ]; then
sed -i -e "s/^user=.*/user=${MANAGEMENT_USER}/" -e "s/^password=.*/password=${MANAGEMENT_PASSWORD}/" /data/.screenly/screenly.conf
fi

echo "Running migration..."
python ./bin/migrate.py

Expand Down
9 changes: 1 addition & 8 deletions server.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
__copyright__ = "Copyright 2012-2023, Screenly, Inc"
__license__ = "Dual License: GPLv2 and Commercial License"

from os import getenv, makedirs, mkdir, path, stat
from os import getenv, path, stat

from flask import (
Flask,
Expand Down Expand Up @@ -165,13 +165,6 @@ def static_with_mime(path):

@app.before_first_request
def main():
# Make sure the asset folder exist. If not, create it
if not path.isdir(settings['assetdir']):
mkdir(settings['assetdir'])
# Create config dir if it doesn't exist
if not path.isdir(settings.get_configdir()):
makedirs(settings.get_configdir())

with db.conn(settings['database']) as conn:
with db.cursor(conn) as cursor:
cursor.execute(queries.exists_table)
Expand Down

0 comments on commit e3cfeb1

Please sign in to comment.