initital commit
This commit is contained in:
9
config/bundles.php
Normal file
9
config/bundles.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
|
||||
JMS\SerializerBundle\JMSSerializerBundle::class => ['all' => true],
|
||||
Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true],
|
||||
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
|
||||
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
|
||||
];
|
||||
19
config/packages/cache.yaml
Normal file
19
config/packages/cache.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
framework:
|
||||
cache:
|
||||
# Unique name of your app: used to compute stable namespaces for cache keys.
|
||||
#prefix_seed: your_vendor_name/app_name
|
||||
|
||||
# The "app" cache stores to the filesystem by default.
|
||||
# The data in this cache should persist between deploys.
|
||||
# Other options include:
|
||||
|
||||
# Redis
|
||||
#app: cache.adapter.redis
|
||||
#default_redis_provider: redis://localhost
|
||||
|
||||
# APCu (not recommended with heavy random-write workloads as memory fragmentation can cause perf issues)
|
||||
#app: cache.adapter.apcu
|
||||
|
||||
# Namespaced pools use the above "app" backend by default
|
||||
#pools:
|
||||
#my.dedicated.cache: null
|
||||
15
config/packages/framework.yaml
Normal file
15
config/packages/framework.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
# see https://symfony.com/doc/current/reference/configuration/framework.html
|
||||
framework:
|
||||
secret: '%env(APP_SECRET)%'
|
||||
|
||||
# Note that the session will be started ONLY if you read or write from it.
|
||||
session: true
|
||||
|
||||
#esi: true
|
||||
#fragments: true
|
||||
|
||||
when@test:
|
||||
framework:
|
||||
test: true
|
||||
session:
|
||||
storage_factory_id: session.storage.factory.mock_file
|
||||
30
config/packages/jms_serializer.yaml
Normal file
30
config/packages/jms_serializer.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
jms_serializer:
|
||||
visitors:
|
||||
xml_serialization:
|
||||
format_output: '%kernel.debug%'
|
||||
# metadata:
|
||||
# auto_detection: false
|
||||
# directories:
|
||||
# any-name:
|
||||
# namespace_prefix: "My\\FooBundle"
|
||||
# path: "@MyFooBundle/Resources/config/serializer"
|
||||
# another-name:
|
||||
# namespace_prefix: "My\\BarBundle"
|
||||
# path: "@MyBarBundle/Resources/config/serializer"
|
||||
|
||||
when@prod:
|
||||
jms_serializer:
|
||||
visitors:
|
||||
json_serialization:
|
||||
options:
|
||||
- JSON_UNESCAPED_SLASHES
|
||||
- JSON_PRESERVE_ZERO_FRACTION
|
||||
|
||||
when@dev:
|
||||
jms_serializer:
|
||||
visitors:
|
||||
json_serialization:
|
||||
options:
|
||||
- JSON_PRETTY_PRINT
|
||||
- JSON_UNESCAPED_SLASHES
|
||||
- JSON_PRESERVE_ZERO_FRACTION
|
||||
9
config/packages/nelmio_api_doc.yaml
Normal file
9
config/packages/nelmio_api_doc.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
nelmio_api_doc:
|
||||
documentation:
|
||||
info:
|
||||
title: Forecast API
|
||||
description: Forecast API
|
||||
version: 1.0.0
|
||||
areas: # to filter documented areas
|
||||
path_patterns:
|
||||
- ^/api(?!/doc$) # Accepts routes under /api except /api/doc
|
||||
10
config/packages/routing.yaml
Normal file
10
config/packages/routing.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
framework:
|
||||
router:
|
||||
# Configure how to generate URLs in non-HTTP contexts, such as CLI commands.
|
||||
# See https://symfony.com/doc/current/routing.html#generating-urls-in-commands
|
||||
#default_uri: http://localhost
|
||||
|
||||
when@prod:
|
||||
framework:
|
||||
router:
|
||||
strict_requirements: null
|
||||
5
config/packages/test/framework.yaml
Normal file
5
config/packages/test/framework.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
framework:
|
||||
test: true
|
||||
session:
|
||||
enabled: true
|
||||
storage_factory_id: "session.storage.factory.mock_file"
|
||||
6
config/packages/twig.yaml
Normal file
6
config/packages/twig.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
twig:
|
||||
file_name_pattern: '*.twig'
|
||||
|
||||
when@test:
|
||||
twig:
|
||||
strict_variables: true
|
||||
11
config/packages/validator.yaml
Normal file
11
config/packages/validator.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
framework:
|
||||
validation:
|
||||
# Enables validator auto-mapping support.
|
||||
# For instance, basic validation constraints will be inferred from Doctrine's metadata.
|
||||
#auto_mapping:
|
||||
# App\Entity\: []
|
||||
|
||||
when@test:
|
||||
framework:
|
||||
validation:
|
||||
not_compromised_password: false
|
||||
5
config/preload.php
Normal file
5
config/preload.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
if (file_exists(dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php')) {
|
||||
require dirname(__DIR__).'/var/cache/prod/App_KernelProdContainer.preload.php';
|
||||
}
|
||||
11
config/routes.yaml
Normal file
11
config/routes.yaml
Normal file
@@ -0,0 +1,11 @@
|
||||
controllers:
|
||||
resource:
|
||||
path: ../src/Controller/
|
||||
namespace: App\Controller
|
||||
type: attribute
|
||||
|
||||
default_route:
|
||||
path: /{url}
|
||||
controller: nelmio_api_doc.controller.swagger_ui
|
||||
requirements:
|
||||
url: ".*"
|
||||
4
config/routes/framework.yaml
Normal file
4
config/routes/framework.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
when@dev:
|
||||
_errors:
|
||||
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
|
||||
prefix: /_error
|
||||
12
config/routes/nelmio_api_doc.yaml
Normal file
12
config/routes/nelmio_api_doc.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
# Expose your documentation as JSON swagger compliant
|
||||
app.swagger:
|
||||
path: /api/doc.json
|
||||
methods: GET
|
||||
defaults: { _controller: nelmio_api_doc.controller.swagger }
|
||||
|
||||
## Requires the Asset component and the Twig bundle
|
||||
## $ composer require twig asset
|
||||
app.swagger_ui:
|
||||
path: /api/doc
|
||||
methods: GET
|
||||
defaults: { _controller: nelmio_api_doc.controller.swagger_ui }
|
||||
78
config/services.yaml
Normal file
78
config/services.yaml
Normal file
@@ -0,0 +1,78 @@
|
||||
# This file is the entry point to configure your own services.
|
||||
# Files in the packages/ subdirectory configure your dependencies.
|
||||
|
||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||
# https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration
|
||||
parameters:
|
||||
openMeteoApiUrl: 'https://api.open-meteo.com/v1/forecast'
|
||||
cities:
|
||||
Praha:
|
||||
lat: 50.073658
|
||||
lon: 14.418540
|
||||
Brno:
|
||||
lat: 49.195061
|
||||
lon: 16.606836
|
||||
Ostrava:
|
||||
lat: 49.820923
|
||||
lon: 18.262524
|
||||
Olomouc:
|
||||
lat: 49.593777
|
||||
lon: 17.250879
|
||||
Plzeň:
|
||||
lat: 49.747059
|
||||
lon: 13.377405
|
||||
Pardubice:
|
||||
lat: 50.04075
|
||||
lon: 15.77659
|
||||
|
||||
|
||||
services:
|
||||
# default configuration for services in *this* file
|
||||
_defaults:
|
||||
autowire: true # Automatically injects dependencies in your services.
|
||||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
||||
|
||||
# makes classes in src/ available to be used as services
|
||||
# this creates a service per class whose id is the fully-qualified class name
|
||||
App\:
|
||||
resource: '../src/'
|
||||
exclude:
|
||||
- '../src/DependencyInjection/'
|
||||
- '../src/Entity/'
|
||||
- '../src/Kernel.php'
|
||||
|
||||
# add more service definitions when explicit configuration is needed
|
||||
# please note that last definitions always *replace* previous ones
|
||||
|
||||
Redis:
|
||||
class: Redis
|
||||
calls:
|
||||
- method: connect
|
||||
arguments:
|
||||
- '%env(REDIS_HOST)%'
|
||||
- '%env(int:REDIS_PORT)%'
|
||||
|
||||
App\Services\Remote\OpenMeteoService:
|
||||
class: App\Services\Remote\OpenMeteoService
|
||||
arguments:
|
||||
$meteoApiUrl: '%openMeteoApiUrl%'
|
||||
$httpClient: '@App\Utils\RetryableHttpClient'
|
||||
|
||||
App\Utils\RetryableHttpClient: ~
|
||||
|
||||
App\Command\FetchForecastData:
|
||||
class: App\Command\FetchForecastData
|
||||
arguments:
|
||||
$forecastForDays: 'P7D'
|
||||
|
||||
App\Controller\ForecastController:
|
||||
class: App\Controller\ForecastController
|
||||
arguments:
|
||||
$forecastForDays: 'P6D'
|
||||
|
||||
App\Services\GeoPointResolverService:
|
||||
class: App\Services\GeoPointResolverService
|
||||
arguments:
|
||||
$geoPointsWithCities: '%cities%'
|
||||
|
||||
App\Services\WeatherProviderInterface: '@App\Services\Remote\OpenMeteoService'
|
||||
35
config/services_test.yaml
Normal file
35
config/services_test.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
services:
|
||||
# default configuration for services in *this* file
|
||||
_defaults:
|
||||
autowire: true # Automatically injects dependencies in your services.
|
||||
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
|
||||
|
||||
# makes classes in src/ available to be used as services
|
||||
# this creates a service per class whose id is the fully-qualified class name
|
||||
App\:
|
||||
resource: '../src/'
|
||||
exclude:
|
||||
- '../src/DependencyInjection/'
|
||||
- '../src/Entity/'
|
||||
- '../src/Kernel.php'
|
||||
|
||||
App\Services\Remote\OpenMeteoService:
|
||||
class: App\Services\Remote\OpenMeteoService
|
||||
public: true
|
||||
arguments:
|
||||
$meteoApiUrl: '%openMeteoApiUrl%'
|
||||
|
||||
App\Services\GeoPointResolverService:
|
||||
class: App\Services\GeoPointResolverService
|
||||
arguments:
|
||||
$geoPointsWithCities: '%cities%'
|
||||
|
||||
App\Command\FetchForecastData:
|
||||
class: App\Command\FetchForecastData
|
||||
arguments:
|
||||
$forecastForDays: 'P7D'
|
||||
|
||||
App\Controller\ForecastController:
|
||||
class: App\Controller\ForecastController
|
||||
arguments:
|
||||
$forecastForDays: 'P7D'
|
||||
Reference in New Issue
Block a user