Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
override application to make sure we can edit the configuration, boot…
Browse files Browse the repository at this point in the history
…strap and storage paths.
  • Loading branch information
Cédric Verstraeten committed Jun 21, 2017
1 parent a20dd91 commit 0a869e7
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 30 deletions.
64 changes: 64 additions & 0 deletions app/Application.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php namespace App;

/*
|--------------------------------------------------------------------------
| Check if running on KiOS
|--------------------------------------------------------------------------
|
| If running on KiOS, data folders are on a different location.
| Therefore we should have a different storage and config directory.
|
*/

class Application extends \Illuminate\Foundation\Application
{
protected $kios = '/data/etc/kios.conf';

/**
* Get the path to the storage directory.
*
* @return string
*/

public function storagePath()
{
if(file_exists($this->kios))
{
return '/data/web/storage';
}

return $this->storagePath ?: $this->basePath.DIRECTORY_SEPARATOR.'storage';
}

/**
* Get the path to the application configuration files.
*
* @param string $path Optionally, a path to append to the config path
* @return string
*/
public function configPath($path = '')
{
if(file_exists($this->kios))
{
return '/data/web/config';
}

return $this->basePath.DIRECTORY_SEPARATOR.'config'.($path ? DIRECTORY_SEPARATOR.$path : $path);
}

/**
* Get the path to the bootstrap directory.
*
* @param string $path Optionally, a path to append to the bootstrap path
* @return string
*/
public function bootstrapPath($path = '')
{
if(file_exists($this->kios))
{
return '/data/web/bootstrap';
}

return $this->basePath.DIRECTORY_SEPARATOR.'bootstrap'.($path ? DIRECTORY_SEPARATOR.$path : $path);
}
}
29 changes: 0 additions & 29 deletions app/User.php

This file was deleted.

9 changes: 8 additions & 1 deletion bootstrap/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,16 @@
| which serves as the "glue" for all the components of Laravel, and is
| the IoC container for the system binding all of the various parts.
|
| --------------
| Special note
| --------------
|
| We've extended the Application so it can work with
| a different configuration location.
|
*/

$app = new Illuminate\Foundation\Application(
$app = new App\Application(
realpath(__DIR__.'/../')
);

Expand Down

0 comments on commit 0a869e7

Please sign in to comment.