1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-19 19:31:31 +02:00

feat(core): update Settings #212 #186

We should use YAML files for configuration instead of JSON
Because of low readability of JSON files for humans.

BREAKING CHANGE: JSON config files should be converted to YAML files
- flextype/confing/settings.yaml
- site/config/settings.yaml
This commit is contained in:
Awilum
2019-08-20 15:47:14 +03:00
parent 50cb8c4c1c
commit 5eb4fc5875
5 changed files with 74 additions and 90 deletions

View File

@@ -49,8 +49,8 @@ $registry = new Registry();
* 3. Merge settings.
* 4. Add settings into the registry.
*/
$default_settings_file_path = PATH['config']['default'] . '/settings.json';
$site_settings_file_path = PATH['config']['site'] . '/settings.json';
$default_settings_file_path = PATH['config']['default'] . '/settings.yaml';
$site_settings_file_path = PATH['config']['site'] . '/settings.yaml';
// Set settings if Flextype settings and Site settings config files exist
if (! Filesystem::has($default_settings_file_path) || ! Filesystem::has($site_settings_file_path)) {
@@ -60,13 +60,13 @@ if (! Filesystem::has($default_settings_file_path) || ! Filesystem::has($site_se
if (($content = Filesystem::read($default_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $default_settings_file_path . ' - failed!');
} else {
$default_settings = JsonParser::decode($content);
$default_settings = Parser::decode($content, 'yaml');
}
if (($content = Filesystem::read($site_settings_file_path)) === false) {
throw new RuntimeException('Load file: ' . $site_settings_file_path . ' - failed!');
} else {
$site_settings = JsonParser::decode($content);
$site_settings = Parser::decode($content, 'yaml');
}
// Merge settings

View File

@@ -1,85 +0,0 @@
{
"title":"Flextype",
"description":"Build fast, flexible, easier to manage websites with Flextype.",
"keywords":"flextype, php, cms, flat-file cms, flat cms, flatfile cms, html",
"robots":"index, follow",
"author":{
"email":"",
"name":""
},
"timezone":"UTC",
"charset":"UTF-8",
"date_format":"F d Y H:i:s",
"theme":"default",
"locale":"en_US",
"entries":{
"main":"home",
"media":{
"upload_images_quality":70,
"upload_images_width":1600,
"upload_images_height":0,
"accept_file_types":"gif, jpg, jpeg, png, ico, zip, tgz, txt, md, doc, docx, pdf, epub, xls, xlsx, ppt, pptx, mp3, ogg, wav, m4a, mp4, m4v, ogv, wmv, avi, webm, svg"
},
"error404":{
"title":"Error 404",
"description":"We're sorry but the page you are looking for doesn't appear to exist!",
"content":"We're sorry but the page you are looking for doesn't appear to exist!",
"template":"default"
}
},
"errors":{
"display":false
},
"cache":{
"enabled":true,
"prefix":"flextype",
"driver":"auto",
"lifetime":604800,
"memcache":{
"server":"localhost",
"port":11211
},
"memcached":{
"server":"localhost",
"port":11211
},
"redis":{
"socket":false,
"password":false,
"server":"localhost",
"port":6379
},
"sqlite3":{
"database":"flextype",
"table":"flextype"
}
},
"admin_panel":{
"theme":"light"
},
"whoops" : {
"editor": "atom",
"page_title": "Error!"
},
"display_error_details": true,
"add_content_length_header": true,
"router_cache_file": false,
"determine_route_before_app_middleware": false,
"output_buffering": "append",
"response_chunk_size": 4096,
"http_version": "1.1",
"twig": {
"auto_reload": true
},
"slugify": {
"separator": "-",
"lowercase": true,
"trim": true,
"regexp": "/[^A-Za-z0-9]+/",
"lowercase_after_regexp": false,
"strip_tags": false
},
"image": {
"driver": "gd"
}
}

View File

@@ -0,0 +1,70 @@
title: Flextype
description: Build fast, flexible, easier to manage websites with Flextype.
keywords: flextype, php, cms, flat-file cms, flat cms, flatfile cms, html
robots: index, follow
author:
email: ''
name: ''
timezone: UTC
charset: UTF-8
date_format: F d Y H:i:s
theme: default
locale: en_US
entries:
main: home
media:
upload_images_quality: 70
upload_images_width: 1600
upload_images_height: 0
accept_file_types: gif, jpg, jpeg, png, ico, zip, tgz, txt, md, doc, docx, pdf,
epub, xls, xlsx, ppt, pptx, mp3, ogg, wav, m4a, mp4, m4v, ogv, wmv, avi, webm,
svg
error404:
title: Error 404
description: We're sorry but the page you are looking for doesn't appear to exist!
content: We're sorry but the page you are looking for doesn't appear to exist!
template: default
errors:
display: false
cache:
enabled: false
prefix: flextype
driver: auto
lifetime: 604800
memcache:
server: localhost
port: 11211
memcached:
server: localhost
port: 11211
redis:
socket: false
password: false
server: localhost
port: 6379
sqlite3:
database: flextype
table: flextype
admin_panel:
theme: light
whoops:
editor: atom
page_title: Error!
display_error_details: true
add_content_length_header: true
router_cache_file: false
determine_route_before_app_middleware: false
output_buffering: append
response_chunk_size: 4096
http_version: '1.1'
twig:
auto_reload: true
slugify:
separator: "-"
lowercase: true
trim: true
regexp: "/[^A-Za-z0-9]+/"
lowercase_after_regexp: false
strip_tags: false
image:
driver: gd

View File

@@ -1 +0,0 @@
{}

View File