tired of this for now, will sort environment variables later

This commit is contained in:
worm 2022-12-30 17:16:59 -08:00
parent 6d61112377
commit 3c26eaeed6
5 changed files with 18 additions and 9 deletions

View file

@ -1,2 +1,6 @@
import { get_run_details } from "./tfc-api-functions";
import { config } from "./config";
import { normalized_config } from "./normalize-config.js";
import { get_run_details } from "./tfc-api-functions.mjs";
const my_config = normalized_config;
console.log(my_config)

View file

@ -1,14 +1,18 @@
import { config } from "./config";
import { config } from "./config.mjs";
default_token = process.env.TOKEN;
default_base_url = "https://app.terraform.io";
mdefault_download_dir = process.cwd();
const default_token = process.env.TOKEN;
const default_base_url = "https://app.terraform.io";
const default_download_dir = process.cwd();
export const normalize_configs = (default_token, default_base_url, default_download_dir) => {
console.log(`Current directory is ${default_download_dir}`);
console.log(process.env);
const normalize_configs = async (default_token, default_base_url, default_download_dir) => {
if(config.base_url === "") {config.base_url = default_base_url};
if(config.token === "") {config.default_token = default_token};
if(config.token === "") {config.token = default_token};
if(config.downloadDir === "") {config.downloadDir = default_download_dir}
return config
}
export const normalized_config = await normalize_configs(default_token, default_base_url, default_download_dir);

View file

@ -3,6 +3,7 @@
"version": "0.0.1",
"description": "This allows you to pull API mocks for TFE/TFC ",
"main": "main.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},