Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

[$250] Clean up gulp config #219

Closed
jmgasper opened this issue Nov 7, 2019 · 10 comments
Closed

[$250] Clean up gulp config #219

jmgasper opened this issue Nov 7, 2019 · 10 comments

Comments

@jmgasper
Copy link
Collaborator

jmgasper commented Nov 7, 2019

@afrisalyp - This line of code is causing some problems with the production CI deployment because the env variable isn't set when Gulp runs, so it's always defaulting to dev

https://github.com/topcoder-platform/topcoder-x-ui/blob/5a75931b3a341d0c6e8d257b1d582d9eb2c9f587/gulp/ng-config.js#L13

As we dug into this further, we see that this influences what's chosen in src/front/config.json.

Is there any reason we need src/front/config.json at all? Can't we just read those values directly from the environmental variables?

I'd like to get this so that we don't use that config file at all, and that way we can avoid the deployment issues as well, thanks.

@jmgasper
Copy link
Collaborator Author

jmgasper commented Nov 7, 2019

Contest https://www.topcoder.com/challenges/30105886 has been created for this ticket.

This is an automated message for ghostar via Topcoder X

@jmgasper
Copy link
Collaborator Author

jmgasper commented Nov 7, 2019

Contest https://www.topcoder.com/challenges/30105886 has been updated - it has been assigned to afrisalyp.

This is an automated message for ghostar via Topcoder X

1 similar comment
@jmgasper
Copy link
Collaborator Author

jmgasper commented Nov 7, 2019

Contest https://www.topcoder.com/challenges/30105886 has been updated - it has been assigned to afrisalyp.

This is an automated message for ghostar via Topcoder X

@afrisalyp
Copy link
Collaborator

@jmgasper
I've investigated the issue and so far I found some points related to this.

  • topcoder-x-ui contains two independent apps, the backend service, and the frontend angular app. The frontend app is accessible as static web content.

  • The problem is related to the frontend. For the frontend, we pass configurations from src/front/config.json and env when we build the angular project into pre-built static angular web app. This is done by gulp. Once the app is built into static public content, it seems it's impossible to pass configuration from env since the env variable is accessible from the web server, and the web server only serves the web content and can't change the content.

Is there any reason we need src/front/config.json at all? Can't we just read those values directly from the environmental variables?

  • src/front/config.json is the configuration file for the frontend app, and src/config.js is the configuration file for the backend.
    It seems it's possible to change src/front/config.json to get from env. But it still needs to be built with gulp. So I don't think that it will resolve the deployment problem.

Please kindly let me know your thoughts on this

@jmgasper
Copy link
Collaborator Author

jmgasper commented Nov 9, 2019

Hmm... What does the frontend use the configs for directly? I'm wondering if we can just build new services for the frontend to call so that it doesn't have to "know about" the config at all.

@jmgasper jmgasper changed the title [$150] Clean up gulp config [$250] Clean up gulp config Nov 9, 2019
@jmgasper
Copy link
Collaborator Author

jmgasper commented Nov 9, 2019

Contest https://www.topcoder.com/challenges/30105886 has been updated - the new changes has been updated for this ticket.

This is an automated message for ghostar via Topcoder X

@afrisalyp
Copy link
Collaborator

Hmm... What does the frontend use the configs for directly? I'm wondering if we can just build new services for the frontend to call so that it doesn't have to "know about" the config at all.

Most of them are URLs. The frontend uses the URLs to call Topcoder API, to redirect to the Topcoder login page and other purposes related to Auth.

So we'll move the configs to the backend and we'll create new service in the backend to fetch the configs. The frontend will get the configs at the page load.
Do you confirm my understanding?

@jmgasper
Copy link
Collaborator Author

jmgasper commented Nov 9, 2019

Yeah, I think that should be fine. It will lessen complexity, which is good.

@afrisalyp afrisalyp mentioned this issue Nov 10, 2019
@afrisalyp
Copy link
Collaborator

@jmgasper
It's ready for review.

@jmgasper
Copy link
Collaborator Author

Payment task has been updated: https://software.topcoder.com/review/actions/ViewProjectDetails?pid=30105886

This is an automated message for ghostar via Topcoder X

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants