tired of this for now, will sort environment variables later
This commit is contained in:
parent
6d61112377
commit
3c26eaeed6
8
main.js
8
main.js
|
@ -1,2 +1,6 @@
|
||||||
import { get_run_details } from "./tfc-api-functions";
|
import { normalized_config } from "./normalize-config.js";
|
||||||
import { config } from "./config";
|
import { get_run_details } from "./tfc-api-functions.mjs";
|
||||||
|
|
||||||
|
const my_config = normalized_config;
|
||||||
|
|
||||||
|
console.log(my_config)
|
|
@ -1,14 +1,18 @@
|
||||||
import { config } from "./config";
|
import { config } from "./config.mjs";
|
||||||
|
|
||||||
default_token = process.env.TOKEN;
|
const default_token = process.env.TOKEN;
|
||||||
default_base_url = "https://app.terraform.io";
|
const default_base_url = "https://app.terraform.io";
|
||||||
mdefault_download_dir = process.cwd();
|
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.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}
|
if(config.downloadDir === "") {config.downloadDir = default_download_dir}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const normalized_config = await normalize_configs(default_token, default_base_url, default_download_dir);
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"description": "This allows you to pull API mocks for TFE/TFC ",
|
"description": "This allows you to pull API mocks for TFE/TFC ",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue