Browse Source

Reorganize configs

imwald
Nuša Pukšič 8 months ago
parent
commit
1d2172974d
  1. 0
      .env.dist
  2. 1
      .gitignore
  3. 28
      README.md
  4. 4
      config/bundles.php
  5. 5
      config/packages/web_profiler.yaml
  6. 1
      config/services.yaml
  7. 9
      src/Command/NostrEventFromYamlDefinitionCommand.php

0
.env → .env.dist

1
.gitignore vendored

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
/.idea/
###> symfony/framework-bundle ###
/.env
/.env.local
/.env.local.php
/.env.*.local

28
README.md

@ -40,6 +40,32 @@ for publishing art and stock images to make them available and discoverable to b @@ -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
```

4
config/bundles.php

@ -10,8 +10,8 @@ return [ @@ -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],

5
config/packages/web_profiler.yaml

@ -1,8 +1,9 @@ @@ -1,8 +1,9 @@
web_profiler:
when@dev:
web_profiler:
toolbar: true
intercept_redirects: false
framework:
framework:
profiler:
only_exceptions: false
collect_serializer_data: true

1
config/services.yaml

@ -5,6 +5,7 @@ @@ -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

9
src/Command/NostrEventFromYamlDefinitionCommand.php

@ -11,6 +11,7 @@ use Symfony\Component\Console\Command\Command; @@ -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; @@ -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 @@ -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) {

Loading…
Cancel
Save