Command line helper for Shopware, WordPress and various other server environment needs.
cli
shopware
bookstack
wordpress
1import { Env } from "./Env";
2
3export class Service {
4 public constructor(public env: Env) {}
5
6 public static async from<T extends typeof Service>(
7 this: T,
8 directory: string,
9 ): Promise<InstanceType<T>> {
10 const env = await Env.from(directory);
11
12 if (!env)
13 throw new Error(
14 "Couldn't generate service. Something is wrong with your .env file, or one isn't present.",
15 );
16
17 return new this(env) as InstanceType<T>;
18 }
19}