init commit

This commit is contained in:
2025-06-05 09:17:47 -04:00
commit db8ec76921
53 changed files with 12126 additions and 0 deletions

10
config/bundles.php Normal file
View File

@@ -0,0 +1,10 @@
<?php
return [
Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true],
Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true],
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],
Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true],
Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle::class => ['all' => true],
];

View 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

View File

@@ -0,0 +1,50 @@
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: '16'
profiling_collect_backtrace: '%kernel.debug%'
use_savepoints: true
orm:
auto_generate_proxy_classes: true
enable_lazy_ghost_objects: true
report_fields_where_declared: true
validate_xml_mapping: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
type: attribute
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

View File

@@ -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

View File

@@ -0,0 +1,24 @@
# see https://symfony.com/doc/current/reference/configuration/framework.html
framework:
secret: '%env(APP_SECRET)%'
annotations: false
http_method_override: false
handle_all_throwables: true
# Enables session support. Note that the session will ONLY be started if you read or write from it.
# Remove or comment this section to explicitly disable session support.
session:
handler_id: null
cookie_secure: auto
cookie_samesite: lax
#esi: true
#fragments: true
php_errors:
log: true
when@test:
framework:
test: true
session:
storage_factory_id: session.storage.factory.mock_file

View File

@@ -0,0 +1,12 @@
framework:
router:
utf8: true
# 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

View File

@@ -0,0 +1,6 @@
twig:
file_name_pattern: '*.twig'
when@test:
twig:
strict_variables: true

5
config/preload.php Normal file
View 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';
}

5
config/routes.yaml Normal file
View File

@@ -0,0 +1,5 @@
controllers:
resource:
path: ../src/Controller/
namespace: App\Controller
type: attribute

View File

@@ -0,0 +1,66 @@
# Console API Routes
console_api_credentials:
path: /api/credentials
controller: App\Controller\ConsoleApiController::credentials
methods: [GET, POST]
console_api_credential_detail:
path: /api/credentials/{id}
controller: App\Controller\ConsoleApiController::credentialDetail
methods: [GET, PUT, DELETE]
requirements:
id: '\d+'
console_api_buckets:
path: /api/buckets
controller: App\Controller\ConsoleApiController::buckets
methods: [GET, POST]
console_api_bucket_detail:
path: /api/buckets/{name}
controller: App\Controller\ConsoleApiController::bucketDetail
methods: [GET, DELETE]
requirements:
name: '[a-z0-9\-\.]+'
console_api_objects:
path: /api/buckets/{bucketName}/objects
controller: App\Controller\ConsoleApiController::objects
methods: [GET, POST, DELETE]
requirements:
bucketName: '[a-z0-9\-\.]+'
console_api_object_detail:
path: /api/buckets/{bucketName}/objects/{objectKey}
controller: App\Controller\ConsoleApiController::objectDetail
methods: [GET, DELETE]
requirements:
bucketName: '[a-z0-9\-\.]+'
objectKey: '.+'
console_api_multipart_uploads:
path: /api/buckets/{bucketName}/multipart-uploads
controller: App\Controller\ConsoleApiController::multipartUploads
methods: [GET]
requirements:
bucketName: '[a-z0-9\-\.]+'
console_api_presigned_urls:
path: /api/presigned-urls
controller: App\Controller\ConsoleApiController::presignedUrls
methods: [GET, POST]
console_api_stats:
path: /api/stats
controller: App\Controller\ConsoleApiController::stats
methods: [GET]
# Console Frontend Route
console_frontend:
path: /console/{route}
controller: App\Controller\ConsoleController::index
methods: [GET]
requirements:
route: '.*'
defaults:
route: ''

4
config/routes/docs.yaml Normal file
View File

@@ -0,0 +1,4 @@
docs_show:
path: /docs
controller: App\Controller\DocsController::show
methods: [GET]

View File

@@ -0,0 +1,4 @@
when@dev:
_errors:
resource: '@FrameworkBundle/Resources/config/routing/errors.xml'
prefix: /_error

121
config/routes/s3_api.yaml Normal file
View File

@@ -0,0 +1,121 @@
# List all buckets
s3_list_buckets:
path: /s3/
controller: App\Controller\S3ApiController::listBuckets
methods: [GET]
# Bucket operations
s3_create_bucket:
path: /s3/{bucket}
controller: App\Controller\S3ApiController::createBucket
methods: [PUT]
requirements:
bucket: '[a-z0-9\-\.]+'
s3_delete_bucket:
path: /s3/{bucket}
controller: App\Controller\S3ApiController::deleteBucket
methods: [DELETE]
requirements:
bucket: '[a-z0-9\-\.]+'
s3_head_bucket:
path: /s3/{bucket}
controller: App\Controller\S3ApiController::headBucket
methods: [HEAD]
requirements:
bucket: '[a-z0-9\-\.]+'
s3_list_objects:
path: /s3/{bucket}
controller: App\Controller\S3ApiController::listObjects
methods: [GET]
requirements:
bucket: '[a-z0-9\-\.]+'
# Object operations
s3_put_object:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::putObject
methods: [PUT]
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
s3_get_object:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::getObject
methods: [GET]
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
s3_head_object:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::headObject
methods: [HEAD]
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
s3_delete_object:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::deleteObject
methods: [DELETE]
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
# Multipart upload operations
s3_initiate_multipart:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::initiateMultipartUpload
methods: [POST]
condition: "request.query.has('uploads')"
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
s3_upload_part:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::uploadPart
methods: [PUT]
condition: "request.query.has('partNumber') and request.query.has('uploadId')"
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
s3_complete_multipart:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::completeMultipartUpload
methods: [POST]
condition: "request.query.has('uploadId') and not request.query.has('uploads')"
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
s3_abort_multipart:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::abortMultipartUpload
methods: [DELETE]
condition: "request.query.has('uploadId')"
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
s3_list_parts:
path: /s3/{bucket}/{key}
controller: App\Controller\S3ApiController::listParts
methods: [GET]
condition: "request.query.has('uploadId')"
requirements:
bucket: '[a-z0-9\-\.]+'
key: '.+'
s3_list_multipart_uploads:
path: /s3/{bucket}
controller: App\Controller\S3ApiController::listMultipartUploads
methods: [GET]
condition: "request.query.has('uploads')"
requirements:
bucket: '[a-z0-9\-\.]+'

27
config/services.yaml Normal file
View File

@@ -0,0 +1,27 @@
# 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:
s3.storage_path: '%kernel.project_dir%/var/s3storage'
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
App\Service\S3Service:
arguments:
$storageBasePath: '%s3.storage_path%'