-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
One of Web Docker's drawbacks is its reliance on a stitched config file, which requires a server function to stitch the uploaded config files. However, in many cases, users should avoid incurring the cost of additional infrastructure. In this scenario, Web Docker should be capable of stitching the files together without relying on a server function.
Proposed API:
export type WebDockerOptions = {
configFilePath?: string;
configPaths?: string[];
logEvents?: boolean;
scope?: string;
};
const webDocker = new Webdocker({
configPaths: ["https://folder/path1", "https://folder/path2"]
});
Possible implementation:
class RemoteConfigurationService {
private readonly configFilePath: string | undefined = undefined;
private readonly configPaths: string[] | undefined = undefined;
constructor(options: WebDockerOptions) {
if (!options.configFilePath && !options.configPaths) {
throw Error ("No Config path was defined");
} else if (options.configFilePath) {
this.configFilePath = options.configFilePath;
} else {
this.configPaths = options.configPaths;
}
}
async fetch(): Promise<Config[] | undefined> {
if (this.configFilePath) {
return this.fetchConfigurations(this.configFilePath);
}
if (this.configPaths) {
return this.fetchAllConfigurations(this.configPaths);
}
}
private async fetchAllConfigurations(configPath: string[]): Config[] {
const configs = []
for (const configPath of configPaths) {
const data = await fetch(configFilePath);
configs.push(await data.json());
}
return configs;
}
}```
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed