diff --git a/conf/admin.sql b/conf/admin.sql index 5bd4d45..3a928e9 100644 --- a/conf/admin.sql +++ b/conf/admin.sql @@ -1,2 +1,2 @@ -INSERT INTO `users` (`id`, `login`, `password`) VALUES (NULL, '__admin__', '__admin_pwd__'); +INSERT INTO `users` (`id`, `login`, `password`) VALUES (NULL, '__ADMIN__', '__ADMIN_PWD__'); diff --git a/conf/config.php b/conf/config.php index 149387b..2aa6296 100755 --- a/conf/config.php +++ b/conf/config.php @@ -16,68 +16,26 @@ * You should have received a copy of the GNU General Public License * along with this program; if not, see . */ + // This is default configuration file. // Copy it to config.php and customize -// default map drawing framework -//$mapapi = "gmaps"; // google maps -//$mapapi = "openlayers"; // openlayers 2 -$mapapi = "openlayers3"; // openlayers 3+ -// openlayers additional map layers in XYZ format -// name => url -$ol_layers['OpenCycleMap'] = 'https://{a-c}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png'; // ?apikey=[API_KEY] -$ol_layers['OpenTopoMap'] = 'https://{a-c}.tile.opentopomap.org/{z}/{x}/{y}.png'; -$ol_layers['ESRI'] = 'https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'; -$ol_layers['UMP'] = 'http://{1-3}.tiles.ump.waw.pl/ump_tiles/{z}/{x}/{y}.png'; -$ol_layers['Osmapa.pl'] = 'http://{a-c}.tile.openstreetmap.pl/osmapa.pl/{z}/{x}/{y}.png'; -// default coordinates for initial map -$init_latitude = 52.23; -$init_longitude = 21.01; -// you may set your google maps api key -$gkey = ""; -// MySQL config -$dbhost = "localhost"; // mysql host, eg. localhost -$dbuser = "__dbuser__"; // database user -$dbpass = "__dbpass__"; // database pass -$dbname = "__dbuser__"; // database name -$dbprefix = ""; // optional table names prefix, eg. "ulogger_" -// other -// require login/password authentication -// (0 = no, 1 = yes) -$require_authentication = 1; -// all users tracks are visible to authenticated user -// (0 = no, 1 = yes) -$public_tracks = 0; -// admin user, who -// - can add new users -// - can edit all tracks, users -// - has access to all users locations -// none if empty -$admin_user = "__admin__"; -// miniumum required length of user password -$pass_lenmin = 12; -// required strength of user password -// 0 = no requirements, -// 1 = require mixed case letters (lower and upper), -// 2 = require mixed case and numbers, -// 3 = require mixed case, numbers and non-alphanumeric characters -$pass_strength = 2; -// Default interval in seconds for live auto reload -$interval = 10; -// Default language -// (en, pl, de, hu) -$lang = "__lang__"; -//$lang = "pl"; -//$lang = "de"; -//$lang = "hu"; -//$lang = "fr"; -//$lang = "it"; -// units -// (metric, imperial) -$units = "metric"; -//$units = "imperial"; -//$units = "nautical"; -// These need to be copied to config.php -$strokeWeight = 2; -$strokeColor = '#FF0000'; -$strokeOpacity = 1.0; + +// Database config + +// PDO data source name, eg.: +// mysql:host=localhost;port=3307;dbname=ulogger;charset=utf8 +// mysql:unix_socket=/tmp/mysql.sock;dbname=ulogger;charset=utf8 +// pgsql:host=localhost;port=5432;dbname=ulogger +// sqlite:/tmp/ulogger.db +$dbdsn = "mysql:host=localhost;port=3307;dbname=__DB_USER__;charset=utf8"; + +// Database user name +$dbuser = "__DB_USER__"; + +// Database user password +$dbpass = "__DB_PWD__"; + +// Optional table names prefix, eg. "ulogger_" +$dbprefix = ""; + ?> diff --git a/scripts/install b/scripts/install index 4545c3c..dcf1d1b 100644 --- a/scripts/install +++ b/scripts/install @@ -43,7 +43,7 @@ test ! -e "$final_path" || ynh_die "This path already contains a folder" # Register (book) web path ynh_webpath_register $app $domain $path_url -admin_password=$(openssl passwd -1 -salt xyz $password) +admin_pwd=$(openssl passwd -1 -salt xyz $password) #================================================= # STORE SETTINGS FROM MANIFEST @@ -112,14 +112,13 @@ chown -R $app: $final_path # MODIFY A CONFIG FILE #================================================= -ynh_replace_string "__dbuser__" "$db_name" "$final_path/config.php" -ynh_replace_string "__dbpass__" "$db_pwd" "$final_path/config.php" -ynh_replace_string "__admin__" "$admin" "$final_path/config.php" -ynh_replace_string "__lang__" "$language" "$final_path/config.php" +ynh_add_config --template="../conf/config.php" --destination="$final_path/config.php" + ynh_replace_string "^\$enabled = false;" "\$enabled = true;" "$final_path/scripts/setup.php" -# Replace variables in sql scripts -ynh_replace_string "__admin__" "$admin" ../conf/admin.sql -ynh_replace_string "__admin_pwd__" "$admin_password" ../conf/admin.sql + +# Replace variables in SQL scripts +ynh_replace_string "__ADMIN__" "$admin" ../conf/admin.sql +ynh_replace_string "__ADMIN_PWD__" "$admin_pwd" ../conf/admin.sql #================================================= # SETUP APPLICATION WITH CURL