How to insert new parameters to config.neon?
Notice: This thread is very old.
- medhi
- Generous Backer | 255
I have users saved in config.neon (https://doc.nette.org/…thentication) and I want to add new users thru a form (web interface). How it is possible?
- David Grudl
- Nette Core | 8218
Oh, why use the hardcore solution?
config:
parameters:
users:
john: password
services:
- MyAuthenticator(..., %users%)
and authenticator:
class MyAuthenticator extends Nette\Object implements Nette\Security\IAuthenticator
{
public function __construct(Nette\Database\Context $database, array $users)
{
$this->database = $database;
$this->users = $users;
}
- Filip Procházka
- Moderator | 4668
Create file app/config/users.neon
that you can write and read
using Neon and include it
- Filip Procházka
- Moderator | 4668
When you have extra config, you simply load only users data, do whatever and write them. You don't rewrite database connections, services, … Which I'm not saing it wouldn't work, it's just not neccesary. Separating the configs feels cleaner.
- Filip Procházka
- Moderator | 4668
You just return the structure
<?php
return array( // parameters.php
'parameters' => array(...),
'nette' => array(...),
);
Last edited by Filip Procházka (2014-01-23 16:19)