Skip to content

feat(admin-ui): injecting env properties dynamically in admin-ui built #1720

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

Closed
duttarnab opened this issue May 23, 2024 · 1 comment · Fixed by #1730, #1731 or #1734
Closed

feat(admin-ui): injecting env properties dynamically in admin-ui built #1720

duttarnab opened this issue May 23, 2024 · 1 comment · Fixed by #1730, #1731 or #1734
Assignees
Labels
comp-admin-ui Component affected by issue or PR enhancement New feature or request kind-feature Issue or PR is a new feature request

Comments

@duttarnab
Copy link
Contributor

duttarnab commented May 23, 2024

The VM/CN installer is not running the npm i or npm run api commands. Instead, it is taking the dependencies and OpenAPI client from https://jenkins.gluu.org/npm/admin_ui/main/, which are generated during the Jenkins build. I think we can have Jenkins create the admin-ui build and place it at https://jenkins.gluu.org/npm/admin_ui/**. This will remove the responsibility of Flex installers to run the npm run build:prod command and hence will solve the long build time problem.

  1. create env-config.js in the root directory admin-ui project with the following contents.
const CONFIG_API_BASE_URL = "https://%(hostname)s/jans-config-api"
const API_BASE_URL = "https://%(hostname)s/jans-config-api/admin-ui"
const BASE_PATH = "/admin/"

window.configApiBaseUrl = CONFIG_API_BASE_URL
window.apiBaseUrl = API_BASE_URL
window.basePath = BASE_PATH
  1. Add <script src="/adminui-config.js" defer></script> in /admin-ui/app/index.html.
  2. Make changes in Admin UI project so that it takes the properties from env-config.js.
@duttarnab duttarnab added enhancement New feature or request comp-admin-ui Component affected by issue or PR kind-feature Issue or PR is a new feature request labels May 23, 2024
@duttarnab duttarnab changed the title feat(admin-ui): receive configApiHost from /admin-ui/config (not from .env) feat(admin-ui): injecting env properties dynamically in admin-ui built May 27, 2024
duttarnab added a commit that referenced this issue May 28, 2024
duttarnab added a commit that referenced this issue May 28, 2024
jv18creator added a commit that referenced this issue May 28, 2024
feat: injecting env properties dynamically in admin-ui built #1720
duttarnab added a commit that referenced this issue May 28, 2024
duttarnab added a commit that referenced this issue May 28, 2024
feat: injecting env properties dynamically in admin-ui built #1720
@duttarnab duttarnab reopened this May 30, 2024
@duttarnab
Copy link
Contributor Author

duttarnab commented May 30, 2024

Reopening to remove BASE_PATH in env-config.js. It is essential to provide this property in .env so it cannot be altered using env-config.js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment