Skip to content

Commit

Permalink
Merge branch 'release/1.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
IllyaMoskvin committed Nov 18, 2021
2 parents 7cea509 + 1bf0287 commit aa75fa8
Show file tree
Hide file tree
Showing 125 changed files with 6,956 additions and 3,765 deletions.
17 changes: 13 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# editorconfig.org
root = true

[*.{js,json,scss,php,php_cs*}]
indent_style = space
indent_size = 4
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
1 change: 0 additions & 1 deletion .env.ci
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ APP_NAME=Laravel
APP_ENV=testing
APP_KEY=base64:nkScfqkJ+t4c4JMZOgO4hEK6gy0rOEF9f71FuL6AuzI=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=testing
Expand Down
66 changes: 32 additions & 34 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
APP_NAME='Data Aggregator'
APP_NAME='API'
APP_ENV='local'
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL='debug'
APP_URL='http://data-aggregator.test'
APP_URL='http://api.test'

# Use these prefixes to version deployments:
DB_PREFIX='dev-v1'
Expand All @@ -12,14 +11,27 @@ ELASTICSEARCH_INDEX='dev-v1'
# Whether to enforce access restrictions on the API
APP_RESTRICTED=true

# CheckIpMiddleware only allows requests from these IPs:
AIC_WHITELIST_IPS='127.0.0.1/32'
# LoginIpMiddleware only allows requests from these IPs:
LOGIN_WHITELIST_IPS='127.0.0.1/32'

ACCESS_WHITELIST_IPS='127.0.0.1/32'

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

# Remove SCOUT_DRIVER's value or replace w/ 'elasticsearch' to activate indexing:
# https://github.com/laravel/scout/issues/34
SCOUT_DRIVER='"null"'
SCOUT_QUEUE=true

# Caching configuration:
CACHE_DRIVER='memcached'
SESSION_DRIVER='memcached'
MEMCACHED_HOST='memcache.test'

FILESYSTEM_DRIVER='local'

# One-time configs on first deploy:
DB_CONNECTION='mysql'
DB_HOST=127.0.0.1
Expand All @@ -28,12 +40,11 @@ DB_DATABASE='homestead'
DB_USERNAME='homestead'
DB_PASSWORD='secret'

ELASTICSEARCH_AWS_REGION=
ELASTICSEARCH_HOST='localhost'
ELASTICSEARCH_PORT=9200
ELASTICSEARCH_SCHEME='http'

ELASTICSEARCH_AWS_REGION=

ELASTICSEARCH_CACHE_ENABLED=false
ELASTICSEARCH_CACHE_TTL=1800 # 30 min
ELASTICSEARCH_CACHE_VERSION='v1'
Expand Down Expand Up @@ -83,52 +94,39 @@ LAKESHORE_URL=''
# Used for prototype:most-similar
WEBSITE_ROOT=''

# Append to each API response:
APP_DOCUMENTATION_URL=
APP_MESSAGE=

# Fix base URL if behind CDN or load balancer:
PROXY_URL=
PROXY_SCHEME=

# Fix for cache if in non-standard location:
HOME=

# TODO: Use `php artisan dump:download` to download a copy of our data:
DUMP_REPO_REMOTE='git@github.com:art-institute-of-chicago/aic-data.git'
DUMP_REPO_NAME=
DUMP_REPO_EMAIL=

# WEB-2013: Disable dumps until they are more reliable
DUMP_SCHEDULE_ENABLED=false

# Error reporting:
SENTRY_LARAVEL_DSN=

# Prototype search algorithm:
SEARCH_BOOST_ARTIST_TITLES=

# Required by Documentable
APP_PRODUCTION_URL='https://api.artic.edu'
# WEB-988: Workaround for ImportsData::query()
WEB_CMS_DATA_SERVICE_USERNAME=
WEB_CMS_DATA_SERVICE_PASSWORD=

# Docs passthrough to GitHub Pages:
DOCS_URL=

# For Google Tag manager:
GTM_ENABLED=true
GTM_ID=

# For `api-data` dumps:
AWS_DEFAULT_REGION='us-east-1'
AWS_BUCKET=

# Unused Laravel default configs:
CACHE_DRIVER='file'
SESSION_DRIVER='file'
SESSION_LIFETIME=120

QUEUE_DRIVER='database'

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER='smtp'
MAIL_HOST='smtp.mailtrap.io'
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

GTM_ENABLED=false
GTM_ID=
AWS_USE_PATH_STYLE_ENDPOINT=false
1 change: 0 additions & 1 deletion .env.testing.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
APP_NAME='Art Institute of Chicago API'
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL='debug'
APP_URL='http://api.test'

# Also defined in phpunit.xml?
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '7.2'
php-version: '7.4'

- name: Create environment file
run: cp .env.ci .env
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ npm-debug.log
!.env.ci
Envoy.blade.php
.phpunit.result.cache
docker-compose.override.yml
.php_cs.cache
.php_cs

Expand All @@ -30,3 +31,5 @@ dist
config.local.js
basement_dist
/public/docs
/.idea
/.vscode
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1
1.2
2 changes: 1 addition & 1 deletion app/ElasticsearchEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Exception;

use ScoutEngines\Elasticsearch\ElasticsearchEngine as BaseEngine;
use Tamayo\LaravelScoutElastic\Engines\ElasticsearchEngine as BaseEngine;

class ElasticsearchEngine extends BaseEngine
{
Expand Down
44 changes: 44 additions & 0 deletions app/Exceptions/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
/**
* A list of the exception types that are not reported.
*
* @var string[]
*/
protected $dontReport = [
//
];

/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var string[]
*/
protected $dontFlash = [
//
];

/**
* Report or log an exception.
*
* @param \Throwable $exception
* @return void
*
* @throws \Throwable
*/
public function report(Throwable $exception)
{
if (app()->bound('sentry') && $this->shouldReport($exception)) {
app('sentry')->captureException($exception);
}

parent::report($exception);
}
}
14 changes: 0 additions & 14 deletions app/Helpers/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@
use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;

/**
* https://tighten.co/blog/a-better-dd-for-your-tdd
*/
function ddd($variable)
{
$cloner = new VarCloner();
$cloner->setMaxItems(10);

$dumper = 'cli' === PHP_SAPI ? new CliDumper() : new HtmlDumper();
$dumper->dump($cloner->cloneVar($variable));

die(1);
}

/**
* Calculates the Cantor tuple function for variable length arguments.
* Accepts an unlimited amount of ids, each as its own argument.
Expand Down
6 changes: 3 additions & 3 deletions app/Http/Controllers/AbstractController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Request as RequestFacade;
use Closure;

use League\Fractal\Resource\Item;
Expand Down Expand Up @@ -98,7 +98,7 @@ protected function getGenericResponse(Arrayable $inputData, string $resourceClas
$this->parseFractalParam('include', 'parseIncludes');
$this->parseFractalParam('exclude', 'parseExcludes');

$fields = Input::get('fields');
$fields = RequestFacade::input('fields');
$transformer = new $this->transformer($fields);
$resource = new $resourceClass($inputData, $transformer);
$data = $this->fractal->createData($resource)->toArray();
Expand Down Expand Up @@ -213,7 +213,7 @@ protected function showMultiple($ids = '', $request = null)
*/
private function parseFractalParam($param, $method)
{
$values = Input::get($param);
$values = RequestFacade::input($param);

if (!isset($values)) {
return;
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace App\Http\Controllers;

use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Routing\Controller as BaseController;

class Controller extends BaseController
{
Expand Down
8 changes: 4 additions & 4 deletions app/Http/Controllers/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Input;
use Illuminate\Support\Facades\Request as RequestFacade;
use Illuminate\Http\Request;
use Elasticsearch;

Expand All @@ -36,7 +36,7 @@ public function __construct()
{
$this->useCache = config('elasticsearch.cache_enabled');

$cacheParam = Input::get('cache');
$cacheParam = RequestFacade::input('cache');
$cacheParam = !is_string($cacheParam) ? $cacheParam : filter_var($cacheParam, FILTER_VALIDATE_BOOLEAN);

if ($this->useCache && $cacheParam === false && Gate::allows('restricted-access')) {
Expand Down Expand Up @@ -159,7 +159,7 @@ private function query($requestMethod, $responseMethod, $elasticsearchMethod, $r
{

// Combine any configuration params
$input = Input::all();
$input = RequestFacade::all();
$input = $requestArgs ? array_merge($input, $requestArgs) : $input;

// Transform our API's syntax into an Elasticsearch params array
Expand Down Expand Up @@ -200,7 +200,7 @@ private function query($requestMethod, $responseMethod, $elasticsearchMethod, $r
*/
private function mquery($requestMethod, $responseMethod, Request $request, $requestArgs = null)
{
$queries = Input::all();
$queries = RequestFacade::all();

if (!is_array($queries) || count(array_filter(array_keys($queries), 'is_string')) > 0) {
// TODO: Accept key'd
Expand Down
Loading

0 comments on commit aa75fa8

Please sign in to comment.