Skip to content
Permalink
Browse files

Move config templates to their own directory

  • Loading branch information...
lonemadmax committed Nov 24, 2018
1 parent 6578706 commit 038a4c154726a954a2dcfb2a9fe4a421a5ca8f52
@@ -81,14 +81,3 @@ tests/screenshot*.png
.freeciv_index
.idea
*.iml

# Configuration files the user is expected to create using the *.dist as base
freeciv-proxy/settings.ini
freeciv-web/flyway.properties
freeciv-web/src/main/webapp/META-INF/context.xml
freeciv-web/src/main/webapp/WEB-INF/config.properties
publite2/settings.ini
scripts/configuration.sh
scripts/config
scripts/dependency-services-start.sh
scripts/dependency-services-stop.sh
@@ -67,9 +67,8 @@ running this command:

You may also want to change some parameters before installing, although
it's not needed in most cases. If you have special requirements, have a look
at [config.dist](scripts/config.dist),
at [config.dist](config/config.dist),
copy it without the `.dist` extension and edit to your liking.
Don't change the `.dist` files, they are the ones from the repo.

#### :warning: Notice for Windows users

@@ -0,0 +1 @@
config
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -18,7 +18,7 @@
# Substitutes variables from the configuration file in the templates.
# gen-from-templates [configfile [source_dir]]
# When source_dir is not given, configfile's parent is used.
# When configfile is not given, script_src_dir/../config is used.
# When configfile is not given, script_src_dir/config is used.

set -e
unset CDPATH
@@ -32,7 +32,7 @@ if [ -z "${CONFIG}" ]; then
echo >&2 "Configuration file not found."
exit 2
fi
CONFIG="${CONFIG}"/../config
CONFIG="${CONFIG}"/config
fi

if [ "${CONFIG:0:1}" = - ]; then
@@ -62,8 +62,9 @@ while IFS= read -r line; do
fi
done < "${CONFIG}" > "${TMPFILE}"

for f in "${SRCDIR}"/{freeciv-proxy,pbem}/settings.ini "${SRCDIR}"/freeciv-web/flyway.properties "${SRCDIR}"/freeciv-web/src/main/webapp/META-INF/context.xml "${SRCDIR}"/freeciv-web/src/main/webapp/WEB-INF/config.properties "${SRCDIR}"/scripts/configuration.sh; do
sed -f "${TMPFILE}" < "$f".dist > "$f"
for f in "${SRCDIR}"/config/*.tmpl; do
DEST="${SRCDIR}"/$(sed -n 's/.* LOCATION:\(.*\)/\1/p' < "$f" | head -n 1)
sed -f "${TMPFILE}" < "$f" > "${DEST}"
done
rm "${TMPFILE}"

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
settings.ini
@@ -0,0 +1 @@
flyway.properties
@@ -40,11 +40,11 @@ Flyway migrations of the database is supported. Remember to set the mysql passwo
To migrate the database to the latest version, run this Maven command:
mvn flyway:migrate

The following files contains MySQL username and password, and must be set manually
if you are not using vagrant:
The following files contain DB, mail and other configuration, and must be set manually
if you are not using vagrant or the install script:

* freeciv-web/src/main/webapp/META-INF/context.xml.dist (rename to context.xml)
* freeciv-web/src/main/webapp/WEB-INF/config.properties.dist (rename to config.properties, contains capcha secret for pbem)
* freeciv-web/src/main/webapp/META-INF/context.xml (you can use config/web.context.tmpl as a template)
* freeciv-web/src/main/webapp/WEB-INF/config.properties (you can use config/web.properties.tmpl as a template)


Copyright (C) 2007-2016 Andreas Røsdal.
@@ -0,0 +1 @@
context.xml
@@ -0,0 +1 @@
config.properties
@@ -0,0 +1 @@
settings.ini
@@ -0,0 +1,3 @@
configuration.sh
dependency-services-start.sh
dependency-services-stop.sh
@@ -185,19 +185,19 @@ if [ $(id -u) = 0 ]; then
exit 3
fi

if [ ! -f "${basedir}"/scripts/config ]; then
if [ ! -f "${basedir}"/config/config ]; then
if [ "${FCW_INSTALL_MODE}" = TEST ]; then
cp "${basedir}"/scripts/config{.dist,}
cp "${basedir}"/config/config{.dist,}
echo "Default config parameters used"
else
echo >&2 "Please copy scripts/config.dist to scripts/config and"
echo >&2 "Please copy config/config.dist to config/config and"
echo >&2 "edit its content to suit your needs."
exit 4
fi
fi
# Remove \r, just in case the file comes from a Windows editor that doesn't
# respect line endings, or from a transformed .dist. See issue #168
sed -i 's/\r$//' "${basedir}"/scripts/config
sed -i 's/\r$//' "${basedir}"/config/config

FCW_INSTALL_SCRIPT=
while IFS=$'\t\r' read -r v r s; do
@@ -215,7 +215,7 @@ if [ -z "${FCW_INSTALL_SCRIPT}" ]; then
exit 5
fi

. "${basedir}/scripts/config"
. "${basedir}/config/config"
. "${basedir}/scripts/install/ext-install.sh"
. "${basedir}/scripts/install/${FCW_INSTALL_SCRIPT}"
echo "System specific install complete (${basedir}/scripts/install/${FCW_INSTALL_SCRIPT})"
@@ -250,7 +250,7 @@ for action in start stop; do
done

echo "==== Filling configuration templates ===="
"${basedir}/scripts/install/gen-from-templates.sh"
"${basedir}/config/gen-from-templates.sh"

echo "==== Setting up DB ===="
pidof mysqld > /dev/null || start_svc mysql

0 comments on commit 038a4c1

Please sign in to comment.
You can’t perform that action at this time.