diff --git a/.env b/.env.dist similarity index 100% rename from .env rename to .env.dist diff --git a/.gitignore b/.gitignore index bcee9a1..3182f27 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ /.idea/ ###> symfony/framework-bundle ### +/.env /.env.local /.env.local.php /.env.*.local diff --git a/README.md b/README.md index 97a1c89..c9492c4 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,32 @@ for publishing art and stock images to make them available and discoverable to b A content management system for creating and updating journals and managing subscriptions. -### Silk Search and Index DVM +### Silk Search and Index An integrated service that provides on-demand indexing and search. + +## Setup + +### Clone the repository + +```bash +git clone https://github.com/decent-newsroom/newsroom.git +cd newsroom +``` + +### Create the .env file + +Copy the example file `.env.dist` and replace placeholders with your actual configuration. + +### Add a project encryption key and nsec +Symfony uses a vault mechanism for managing secrets securely. +To save the nsec, run this command inside your Docker container: + +```bash +docker-compose exec php bin/console secrets:set APP_NSEC +``` + +To save the encryption key: +```bash +docker-compose exec php bin/console secrets:set APP_ENCRYPTION_KEY +``` diff --git a/config/bundles.php b/config/bundles.php index dcbd623..dccdfdf 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -10,8 +10,8 @@ return [ Twig\Extra\TwigExtraBundle\TwigExtraBundle::class => ['all' => true], Symfony\UX\TwigComponent\TwigComponentBundle::class => ['all' => true], Symfony\UX\LiveComponent\LiveComponentBundle::class => ['all' => true], - Symfony\Bundle\MakerBundle\MakerBundle::class => ['all' => true, 'prod' => false], - Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['all' => true, 'prod' => false], + Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true], Symfony\Bundle\SecurityBundle\SecurityBundle::class => ['all' => true], Symfony\UX\Icons\UXIconsBundle::class => ['all' => true], FOS\ElasticaBundle\FOSElasticaBundle::class => ['all' => true], diff --git a/config/packages/web_profiler.yaml b/config/packages/web_profiler.yaml index ffb9ff7..7b4c1bd 100644 --- a/config/packages/web_profiler.yaml +++ b/config/packages/web_profiler.yaml @@ -1,8 +1,9 @@ -web_profiler: - toolbar: true - intercept_redirects: false +when@dev: + web_profiler: + toolbar: true + intercept_redirects: false -framework: - profiler: - only_exceptions: false - collect_serializer_data: true + framework: + profiler: + only_exceptions: false + collect_serializer_data: true diff --git a/config/services.yaml b/config/services.yaml index 2cff107..7fb58f2 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -5,6 +5,7 @@ # https://symfony.com/doc/current/best_practices.html#use-parameters-for-application-configuration parameters: encryption_key: '%env(APP_ENCRYPTION_KEY)%' + nsec: '%env(APP_NSEC)%' services: # default configuration for services in *this* file diff --git a/src/Command/NostrEventFromYamlDefinitionCommand.php b/src/Command/NostrEventFromYamlDefinitionCommand.php index cf5e79a..516247e 100644 --- a/src/Command/NostrEventFromYamlDefinitionCommand.php +++ b/src/Command/NostrEventFromYamlDefinitionCommand.php @@ -11,6 +11,7 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\Finder\Finder; use Symfony\Component\Yaml\Yaml; use Symfony\Contracts\Cache\CacheInterface; @@ -18,10 +19,11 @@ use Symfony\Contracts\Cache\CacheInterface; #[AsCommand(name: 'app:yaml_to_nostr', description: 'Traverses folders, converts YAML files to JSON using object mapping, and saves the result in Redis cache.')] class NostrEventFromYamlDefinitionCommand extends Command { - const private_key = 'nsec17ygfd40ckdwmrl4mzhnzzdr3c8j5kvnavgrct35hglha9ue396dslsterv'; + private string $nsec; - public function __construct(private readonly CacheInterface $redisCache) + public function __construct(private readonly CacheInterface $redisCache, ParameterBagInterface $bag) { + $this->nsec = $bag->get('nsec'); parent::__construct(); } @@ -56,12 +58,11 @@ class NostrEventFromYamlDefinitionCommand extends Command // Deserialize YAML content into an Event object $event = new Event(); $event->setKind(30040); - $event->setPublicKey('e00983324f38e8522ffc01d5c064727e43fe4c43d86a5c2a0e73290674e496f8'); $tags = $yamlContent['tags']; $event->setTags($tags); $signer = new Sign(); - $signer->signEvent($event, NostrEventFromYamlDefinitionCommand::private_key); + $signer->signEvent($event, $this->nsec); // Save to cache $slug = array_filter($tags, function ($tag) {