@@ -19,11 +19,21 @@ public function __construct(string $docType)
19
19
'name ' => config ('app.name ' ),
20
20
'description ' => config ('app.name ' ) . ' ( ' . ucfirst ($ docType ) . ' API) Documentation ' ,
21
21
'title ' => 'Welcome to ' . config ('app.name ' ),
22
- 'url ' => config ( ' apiato.api.url ' ),
23
- 'sampleUrl ' => config ('vendor-documentation.enable-sending-sample-request ' ) ? config ( ' apiato.api.url ' ) : null ,
22
+ 'url ' => $ this -> getFullUrl ( ),
23
+ 'sampleUrl ' => config ('vendor-documentation.enable-sending-sample-request ' ) ? $ this -> getFullUrl ( ) : null ,
24
24
];
25
25
}
26
26
27
+ private function getFullUrl (): string
28
+ {
29
+ return config ('apiato.api.url ' ) . $ this ->prepareUrlPrefix ();
30
+ }
31
+
32
+ private function prepareUrlPrefix (): string
33
+ {
34
+ return rtrim (config ('apiato.api.prefix ' ), '/ ' );
35
+ }
36
+
27
37
/**
28
38
* Read the markdown header template and fill it with some real data from the .env file.
29
39
*/
@@ -43,7 +53,7 @@ public function run(): string
43
53
//Encode the array back into a JSON string.
44
54
$ jsonContent = json_encode ($ contentsDecoded );
45
55
46
- // this is what the apidoc.json file will point to to load the header.md
56
+ // this is what the apidoc.json file will point to, to load the header.md
47
57
// write the actual file
48
58
$ path = app_path ($ this ->outputPath );
49
59
file_put_contents ($ path , $ jsonContent );
0 commit comments