Skip to content

Commit df7d3dc

Browse files
committed
Allow base dir configuration
1 parent 2d721c6 commit df7d3dc

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

config/typesetsh.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616
public_path(),
1717
],
1818

19+
/*
20+
|--------------------------------------------------------------------------
21+
| Base directories
22+
|--------------------------------------------------------------------------
23+
|
24+
| The base directory to use for relative paths.
25+
|
26+
*/
27+
28+
'base_dir' => public_path(),
29+
1930
/*
2031
|--------------------------------------------------------------------------
2132
| Allowed protocols for downloading

src/ServiceProvider.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ protected function registerPdfRenderer(): void
3636
{
3737
$this->app->singleton('typesetsh', function ($app) {
3838
$allowedDirectories = $app['config']['typesetsh.allowed_directories'] ?? [];
39+
$baseDir = $app['config']['typesetsh.base_dir'] ?? [];
3940
$allowProtocols = $app['config']['typesetsh.allowed_protocols'] ?? [];
4041
$cacheDir = $app['config']['typesetsh.cache_dir'] ?? null;
4142
$timeout = (int)($app['config']['typesetsh.timeout'] ?? 15);
@@ -54,7 +55,7 @@ protected function registerPdfRenderer(): void
5455
$schemes['file'] = new UriResolver\File($allowedDirectories);
5556
}
5657

57-
return new Typesetsh(new UriResolver($schemes));
58+
return new Typesetsh(new UriResolver($schemes, $baseDir));
5859
});
5960

6061
$this->app->singleton('typesetsh.pdf', function ($app) {

0 commit comments

Comments
 (0)