Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch api values #237

Open
wants to merge 2 commits into
base: legacy
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/app/contents/fields/generic.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import categories from "../categories";
import scopes from "../scopes";
import scopes_default from "../scopes";
import licenses from "../licenses";
import langs from "../langs";
import countries from "../countries";
Expand All @@ -24,8 +24,23 @@ const softwareType_list = [
];

let versions = null;
let scopes = null;

const fields = async () => {
// if provided in .env file, fetch the scopes values from that URL
if(process.env.SCOPES_API) {
let scopes_api = new Array()
let response = await fetch(process.env.SCOPES_API)
let json = await response.json()
json[0].children.forEach(element => {
scopes_api.push(element.text)
});
console.log("Taxonomy issues", scopes_api)
scopes = scopes_api
} else {
scopes = scopes_default
}

if (!versions) {
// console.log("get versions");
try {
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ module.exports = env => {
REPOSITORY: JSON.stringify(process.env.REPOSITORY),
ELASTIC_URL: JSON.stringify(process.env.ELASTIC_URL),
VALIDATOR_URL: JSON.stringify(process.env.VALIDATOR_URL),
VALIDATOR_REMOTE_URL: JSON.stringify(process.env.VALIDATOR_REMOTE_URL)
VALIDATOR_REMOTE_URL: JSON.stringify(process.env.VALIDATOR_REMOTE_URL),
SCOPES_API: JSON.stringify(process.env.SCOPES_API)
}
}),
new HtmlWebpackPlugin({
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ module.exports = env => {
REPOSITORY: JSON.stringify(process.env.REPOSITORY),
ELASTIC_URL: JSON.stringify(process.env.ELASTIC_URL),
VALIDATOR_URL: JSON.stringify(process.env.VALIDATOR_URL),
VALIDATOR_REMOTE_URL: JSON.stringify(process.env.VALIDATOR_REMOTE_URL)
VALIDATOR_REMOTE_URL: JSON.stringify(process.env.VALIDATOR_REMOTE_URL),
SCOPES_API: JSON.stringify(process.env.SCOPES_API)
}
}),
new HtmlWebpackPlugin({
Expand Down