Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Config consolidation
- Consolidate application and server configs into one
- Use json for config file
- Split config loading into separate lib file
- Add config exception
  • Loading branch information
DHS committed Nov 20, 2014
1 parent 73509ef commit f43b055
Show file tree
Hide file tree
Showing 9 changed files with 313 additions and 268 deletions.
63 changes: 0 additions & 63 deletions config/application.json

This file was deleted.

113 changes: 0 additions & 113 deletions config/application.php

This file was deleted.

87 changes: 87 additions & 0 deletions config/config.json
@@ -0,0 +1,87 @@
{
"name": "Ratter",
"tagline": "Ratter is an app to demonstrate the functionality of <a href=\"http://github.com/DHS/rat\">Rat</a>",
"default_controller": "items",
"beta": 1,
"private": 1,
"signup_email_notifications": 0,
"items": {
"name": "post",
"name_plural": "posts",
"titles": {
"enabled": 1,
"name": "Title",
"name_plural": "Titles"
},
"content": {
"enabled": 1,
"name": "Content",
"name_plural": "Contents"
},
"uploads": {
"enabled": 1,
"name": "Image",
"directory": "uploads",
"max-size": "5242880",
"mime_types": [
"image/jpeg",
"image/png",
"image/gif",
"image/pjpeg"
]
},
"comments": {
"enabled": 1,
"name": "Comment",
"name_plural": "Comments"
},
"likes": {
"enabled": 1,
"name": "Like",
"name_plural": "Likes",
"opposite_name": "Unlike",
"past_tense": "Liked by"
}
},
"timezone": "Europe/London",
"invites": {
"enabled": 1
},
"friends": {
"enabled": 0,
"asymmetric": 0
},
"admin_users": [
1
],
"theme": "default",
"plugins": {
"log": 1,
"gravatar": 1,
"points": 0,
"analytics": 0
},
"send_emails_from": "support@blah.com",
"url": "http://example.com",
"dev_url": "http://127.0.0.1",
"live_base_dir": "/",
"dev_base_dir": "/rat",
"send_emails": 1,
"encryption_salt": "hw9e46",
"database": {
"dev": {
"host": "localhost",
"username": "root",
"passsword": "",
"database": "rat",
"prefix": ""
},
"live": {
"host": "localhost",
"username": "root",
"passsword": "root",
"database": "rat",
"prefix": ""
}
}
}
40 changes: 0 additions & 40 deletions config/server-sample.php

This file was deleted.

2 changes: 1 addition & 1 deletion controllers/comments_controller.php
Expand Up @@ -17,7 +17,7 @@ function add() {
if ($item->user->email_notifications['item_comment']) {

$to = array('name' => $item->user->username, 'email' => $item->user->email);
$subject = '[' . $this->config->name . '] Someone left a ' . strtolower($this->config->items['comments']['name']) . ' on your ' . strtolower($this->config->items['titles']['name']) . ' on ' . $this->config->name . '!';
$subject = '[' . $this->config->name . '] Someone left a ' . strtolower($this->config->items->comments->name) . ' on your ' . strtolower($this->config->items->titles->name) . ' on ' . $this->config->name . '!';
$link = substr($this->config->url, 0, -1) . $this->url_for('items', 'show', $item->id);
$body = $this->twig_string->render(file_get_contents("themes/{$this->config->theme}/emails/item_comment.html"), array('link' => $link, 'app' => $this, 'user' => $item->user));

Expand Down

0 comments on commit f43b055

Please sign in to comment.