export interface EnvVariables {
    containerName?: string;
}

export class EnvUtils {

    private static cached?: EnvVariables;

    public static get() {
        if (this.cached) {
            return this.cached;
        }
        this.cached = EnvUtils.getEnvVariablesFromHostEnv(process.env as { [key: string]: string; });
        return this.cached;
    }

    private static getEnvVariablesFromHostEnv(env: { [key: string]: string; }): EnvVariables {
        return {
            containerName: env.REACT_APP_CONTAINER_NAME,
        };
    }

    public static reloadEnv() {
        this.cached = undefined;
        return this.get();
    }
}
