mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
feat: Create SetupHttpHandler
This handler allows users to set up servers with a pod and without having to enable public access first
This commit is contained in:
@@ -26,9 +26,9 @@ export class GeneratedPodManager implements PodManager {
|
||||
* Creates a new pod, pre-populating it with the resources created by the data generator.
|
||||
* Will throw an error if the given identifier already has a resource.
|
||||
*/
|
||||
public async createPod(identifier: ResourceIdentifier, settings: PodSettings): Promise<void> {
|
||||
public async createPod(identifier: ResourceIdentifier, settings: PodSettings, overwrite: boolean): Promise<void> {
|
||||
this.logger.info(`Creating pod ${identifier.path}`);
|
||||
if (await this.store.resourceExists(identifier)) {
|
||||
if (!overwrite && await this.store.resourceExists(identifier)) {
|
||||
throw new ConflictHttpError(`There already is a resource at ${identifier.path}`);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ export interface PodManager {
|
||||
* Creates a pod for the given settings.
|
||||
* @param identifier - Root identifier indicating where the pod should be created.
|
||||
* @param settings - Settings describing the pod.
|
||||
* @param overwrite - If the creation should proceed if there already is a resource there.
|
||||
*/
|
||||
createPod: (identifier: ResourceIdentifier, settings: PodSettings) => Promise<void>;
|
||||
createPod: (identifier: ResourceIdentifier, settings: PodSettings, overwrite: boolean) => Promise<void>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user