Updated dependencies, improved config
* Configuration now key-value map with friendly accessors. * Configuration file maps 1:1
This commit is contained in:
		@@ -31,8 +31,9 @@ if (isset($opts['C'])) {
 | 
			
		||||
        exit(1);
 | 
			
		||||
    }
 | 
			
		||||
    file_put_contents($file, <<<DEFAULTS
 | 
			
		||||
    listeners:
 | 
			
		||||
    - address: 0.0.0.0:9000
 | 
			
		||||
    server:
 | 
			
		||||
      public_url: https://example.com
 | 
			
		||||
      address: 0.0.0.0:9000
 | 
			
		||||
      cors:
 | 
			
		||||
        allow_origin: '*'
 | 
			
		||||
        csp: "default-src * 'self' http: 'unsafe-eval' 'unsafe-inline'; connect-src * 'self'"
 | 
			
		||||
@@ -62,20 +63,12 @@ if (isset($opts['c'])) {
 | 
			
		||||
    $config = Configuration::fromFile($opts['c']);
 | 
			
		||||
} else {
 | 
			
		||||
    $config = Configuration::createDefault()
 | 
			
		||||
        ->addListener([
 | 
			
		||||
            'address' => '127.0.0.1:8888',
 | 
			
		||||
            'subscribe' => [
 | 
			
		||||
                'anonymous' => true
 | 
			
		||||
            ]
 | 
			
		||||
        ])
 | 
			
		||||
        ->setListenAddress('127.0.0.1:8888')
 | 
			
		||||
        ->setAllowOriginHeader("*")
 | 
			
		||||
        ->setContentSecurityPolicyHeader("default-src * 'self' http: 'unsafe-eval' 'unsafe-inline'; connect-src * 'self'")
 | 
			
		||||
        ->setAllowAnonymousSubscribe(true)
 | 
			
		||||
        ->setJwtSecret("!ChangeThisMercureHubJWTSecretKey!");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (count($config->getListeners()) == 0) {
 | 
			
		||||
    fwrite(STDERR, "No listeners available\n");
 | 
			
		||||
    exit(1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$daemon = new Daemon($config);
 | 
			
		||||
$daemon->start();
 | 
			
		||||
		Reference in New Issue
	
	Block a user