config generation now testable

This commit is contained in:
worm 2022-12-30 16:33:54 -08:00
parent bfd9cdc4d6
commit 6d61112377

View file

@ -1,8 +1,14 @@
import { config } from "./config"; import { config } from "./config";
default_token = process.env.TOKEN;
default_base_url = "https://app.terraform.io";
mdefault_download_dir = process.cwd();
export const normalize_configs = (default_token, default_base_url, default_download_dir) => { export const normalize_configs = (default_token, default_base_url, default_download_dir) => {
if(config.base_url === "") {config.base_url = default_base_url}; if(config.base_url === "") {config.base_url = default_base_url};
if(config.token === "") {config.default_token = default_token}; if(config.token === "") {config.default_token = default_token};
if(config.downloadDir === "") {config.downloadDir = default_download_dir} if(config.downloadDir === "") {config.downloadDir = default_download_dir}
return config
} }