- //TODO: change config to name and get other values from RAPSYSPACK_REDIRECT, RAPSYSPACK_SCHEME, RAPSYSPACK_TIMEOUT, RAPSYSPACK_AGENT env variables ?
- public function __construct(protected FileLocator $locator, protected PackageInterface $package, protected array $config, protected string $tag, protected string $output, protected array $filters) {
- //Set ctx
- $this->ctx = stream_context_create(
- [
- 'http' => [
- #'header' => ['Referer: https://www.openstreetmap.org/'],
- //TODO: set as bundle env config
- 'max_redirects' => $config['redirect']?:5,
- //TODO: set as bundle env config
- 'timeout' => $config['timeout']?:(int)ini_get('default_socket_timeout'),
- #'user_agent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36',
- //TODO: set as bundle env config
- 'user_agent' => $config['agent']?:(string)ini_get('user_agent')?:'rapsys_pack/2.0.0',
- ]
- ]
- );
+ public function __construct(protected ContainerInterface $container, protected FileLocator $locator, protected RouterInterface $router, protected SluggerUtil $slugger, protected array $config, protected mixed $ctx, protected string $prefix, protected string $tag) {
+ //Set filters
+ $this->filters = $config['filters'][$prefix];
+
+ //Set output
+ $this->output = $config['public'].'/'.$config['prefixes']['pack'].'/'.$config['prefixes'][$prefix].'/*.'.$prefix;
+
+ //Set route
+ $this->route = $config['routes'][$prefix];
+
+ //Set token
+ $this->token = $config['tokens'][$prefix];