parent
49787b6d23
commit
bc1d5df582
@ -1,20 +0,0 @@
|
||||
# In all environments, the following files are loaded if they exist,
|
||||
# the latter taking precedence over the former:
|
||||
#
|
||||
# * .env contains default values for the environment variables needed by the app
|
||||
# * .env.local uncommitted file with local overrides
|
||||
# * .env.$APP_ENV committed environment-specific defaults
|
||||
# * .env.$APP_ENV.local uncommitted environment-specific overrides
|
||||
#
|
||||
# Real environment variables win over .env files.
|
||||
#
|
||||
# DO NOT DEFINE PRODUCTION SECRETS IN THIS FILE NOR IN ANY OTHER COMMITTED FILES.
|
||||
# https://symfony.com/doc/current/configuration/secrets.html
|
||||
#
|
||||
# Run "composer dump-env prod" to compile .env files for production use (requires symfony/flex >=1.2).
|
||||
# https://symfony.com/doc/current/best_practices.html#use-environment-variables-for-infrastructure-configuration
|
||||
|
||||
###> symfony/framework-bundle ###
|
||||
APP_ENV=dev
|
||||
APP_SECRET=30741bdb272c30098a12fa66d60c4c85
|
||||
###< symfony/framework-bundle ###
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,44 @@
|
||||
doctrine:
|
||||
dbal:
|
||||
url: '%env(resolve:DATABASE_URL)%'
|
||||
|
||||
# IMPORTANT: You MUST configure your server version,
|
||||
# either here or in the DATABASE_URL env var (see .env file)
|
||||
#server_version: '15'
|
||||
orm:
|
||||
auto_generate_proxy_classes: true
|
||||
enable_lazy_ghost_objects: true
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
|
||||
auto_mapping: true
|
||||
mappings:
|
||||
App:
|
||||
is_bundle: false
|
||||
dir: '%kernel.project_dir%/src/Entity'
|
||||
prefix: 'App\Entity'
|
||||
alias: App
|
||||
|
||||
when@test:
|
||||
doctrine:
|
||||
dbal:
|
||||
# "TEST_TOKEN" is typically set by ParaTest
|
||||
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
|
||||
|
||||
when@prod:
|
||||
doctrine:
|
||||
orm:
|
||||
auto_generate_proxy_classes: false
|
||||
proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
|
||||
query_cache_driver:
|
||||
type: pool
|
||||
pool: doctrine.system_cache_pool
|
||||
result_cache_driver:
|
||||
type: pool
|
||||
pool: doctrine.result_cache_pool
|
||||
|
||||
framework:
|
||||
cache:
|
||||
pools:
|
||||
doctrine.result_cache_pool:
|
||||
adapter: cache.app
|
||||
doctrine.system_cache_pool:
|
||||
adapter: cache.system
|
@ -0,0 +1,6 @@
|
||||
doctrine_migrations:
|
||||
migrations_paths:
|
||||
# namespace is arbitrary but should be different from App\Migrations
|
||||
# as migrations classes should NOT be autoloaded
|
||||
'DoctrineMigrations': '%kernel.project_dir%/migrations'
|
||||
enable_profiler: false
|
@ -0,0 +1,4 @@
|
||||
lexik_jwt_authentication:
|
||||
secret_key: '%env(resolve:JWT_SECRET_KEY)%'
|
||||
public_key: '%env(resolve:JWT_PUBLIC_KEY)%'
|
||||
pass_phrase: '%env(JWT_PASSPHRASE)%'
|
@ -0,0 +1,10 @@
|
||||
nelmio_cors:
|
||||
defaults:
|
||||
origin_regex: true
|
||||
allow_origin: ['%env(CORS_ALLOW_ORIGIN)%']
|
||||
allow_methods: ['GET', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE']
|
||||
allow_headers: ['Content-Type', 'Authorization']
|
||||
expose_headers: ['Link']
|
||||
max_age: 3600
|
||||
paths:
|
||||
'^/': null
|
@ -0,0 +1,39 @@
|
||||
security:
|
||||
# https://symfony.com/doc/current/security.html#registering-the-user-hashing-passwords
|
||||
password_hashers:
|
||||
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: 'auto'
|
||||
# https://symfony.com/doc/current/security.html#loading-the-user-the-user-provider
|
||||
providers:
|
||||
users_in_memory: { memory: null }
|
||||
firewalls:
|
||||
dev:
|
||||
pattern: ^/(_(profiler|wdt)|css|images|js)/
|
||||
security: false
|
||||
main:
|
||||
lazy: true
|
||||
provider: users_in_memory
|
||||
|
||||
# activate different ways to authenticate
|
||||
# https://symfony.com/doc/current/security.html#the-firewall
|
||||
|
||||
# https://symfony.com/doc/current/security/impersonating_user.html
|
||||
# switch_user: true
|
||||
|
||||
# Easy way to control access for large sections of your site
|
||||
# Note: Only the *first* access control that matches will be used
|
||||
access_control:
|
||||
# - { path: ^/admin, roles: ROLE_ADMIN }
|
||||
# - { path: ^/profile, roles: ROLE_USER }
|
||||
|
||||
when@test:
|
||||
security:
|
||||
password_hashers:
|
||||
# By default, password hashers are resource intensive and take time. This is
|
||||
# important to generate secure password hashes. In tests however, secure hashes
|
||||
# are not important, waste resources and increase test times. The following
|
||||
# reduces the work factor to the lowest possible values.
|
||||
Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface:
|
||||
algorithm: auto
|
||||
cost: 4 # Lowest possible value for bcrypt
|
||||
time_cost: 3 # Lowest possible value for argon
|
||||
memory_cost: 10 # Lowest possible value for argon
|
@ -0,0 +1,6 @@
|
||||
twig:
|
||||
default_path: '%kernel.project_dir%/templates'
|
||||
|
||||
when@test:
|
||||
twig:
|
||||
strict_variables: true
|
@ -0,0 +1,4 @@
|
||||
framework:
|
||||
uid:
|
||||
default_uuid_version: 7
|
||||
time_based_uuid_version: 7
|
@ -0,0 +1,13 @@
|
||||
framework:
|
||||
validation:
|
||||
email_validation_mode: html5
|
||||
|
||||
# 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
|
@ -0,0 +1,4 @@
|
||||
api_platform:
|
||||
resource: .
|
||||
type: api_platform
|
||||
prefix: /api
|
@ -0,0 +1,14 @@
|
||||
<?php
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
|
||||
#[ApiResource]
|
||||
class Capital extends Thing
|
||||
{
|
||||
|
||||
public Country $country;
|
||||
|
||||
public Dungeon $dungeon;
|
||||
}
|
||||
|
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
|
||||
#[ApiResource]
|
||||
class Character extends Thing
|
||||
{
|
||||
|
||||
/**
|
||||
* FIXME: Use enumeration
|
||||
*/
|
||||
public const ROOKIE = 'rookie';
|
||||
|
||||
public const ACTIVE = 'active';
|
||||
|
||||
public const MASTER = 'master';
|
||||
|
||||
public const GRANDMASTER = 'grand-master';
|
||||
|
||||
/**
|
||||
*
|
||||
* @ApiPlatform\ApiProperty(
|
||||
* attributes={
|
||||
* "openapi_context" = {
|
||||
* "type"="string",
|
||||
* "enum"={"rookie", "active", "master", "grand-master"},
|
||||
* "example"="active",
|
||||
* }
|
||||
* }
|
||||
* )
|
||||
*/
|
||||
public string $role;
|
||||
|
||||
/**
|
||||
* Calculates the aged based on the ulid value?
|
||||
*/
|
||||
public function getAge(): int
|
||||
{
|
||||
return 17;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
|
||||
#[ApiResource]
|
||||
class Country extends Thing
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @ApiPlatform\ApiSubresource(maxDepth=1)
|
||||
*/
|
||||
public Capital $capital;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ApiPlatform\ApiSubresource(maxDepth=1)
|
||||
* @var Village[]
|
||||
*/
|
||||
public iterable $villages;
|
||||
}
|
||||
|
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
|
||||
#[ApiResource]
|
||||
class Dojo extends Thing
|
||||
{
|
||||
|
||||
public string $name;
|
||||
|
||||
/**
|
||||
* The unique identifier of the owner of this Dojo
|
||||
*
|
||||
* @ApiPlatform\ApiProperty(writable=false, description="owner of the dojo (player)")
|
||||
* @ApiPlatform\ApiSubresource(maxDepth=1)
|
||||
*/
|
||||
public Player $owner;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ApiPlatform\ApiSubresource(maxDepth=1)
|
||||
* @var Character[]
|
||||
*/
|
||||
public iterable $members;
|
||||
|
||||
/**
|
||||
*
|
||||
* @ApiPlatform\ApiProperty
|
||||
*/
|
||||
public Village $village;
|
||||
|
||||
/**
|
||||
* Helper method that reads the timestamp section from the ulid
|
||||
*/
|
||||
public function getCreatedAt(): \DateTimeImmutable
|
||||
{
|
||||
return $this->id->getDateTime();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
|
||||
/**
|
||||
* The capital is the center of the country the villages are located in.
|
||||
*
|
||||
* @ApiPlatform\ApiResource(
|
||||
* itemOperations={"get"},
|
||||
* collectionOperations={}
|
||||
* )
|
||||
*/
|
||||
#[ApiResource]
|
||||
class Dungeon extends Thing
|
||||
{
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use ApiPlatform\Metadata\Get;
|
||||
use ApiPlatform\Metadata\GetCollection;
|
||||
|
||||
#[ApiResource(
|
||||
operations: [new Get(), new GetCollection()]
|
||||
)]
|
||||
class Player extends Thing
|
||||
{
|
||||
|
||||
public string $name;
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
use Symfony\Component\Uid\Ulid;
|
||||
|
||||
#[ApiResource]
|
||||
class Thing
|
||||
{
|
||||
|
||||
public Ulid $id;
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
namespace App\ApiResource;
|
||||
|
||||
use ApiPlatform\Metadata\ApiResource;
|
||||
|
||||
#[ApiResource]
|
||||
class Village extends Thing
|
||||
{
|
||||
|
||||
/**
|
||||
*
|
||||
* @ApiPlatform\ApiSubresource(maxDepth=1)
|
||||
* @var Dojo[]
|
||||
*/
|
||||
public iterable $dojos;
|
||||
|
||||
public Capital $capital;
|
||||
}
|
||||
|
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text></svg>">
|
||||
{# Run `composer require symfony/webpack-encore-bundle` to start using Symfony UX #}
|
||||
{% block stylesheets %}
|
||||
{{ encore_entry_link_tags('app') }}
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{{ encore_entry_script_tags('app') }}
|
||||
{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in new issue