Skip to content

Move gui and user-system configurations to core/config and host config-retrieval endpoints via core/config-service - #3458

Merged
bobbai00 merged 32 commits into
masterfrom
jiadong-move-config-to-backend
Jun 10, 2025
Merged

bobbai00 merged 32 commits into
masterfrom
jiadong-move-config-to-backend

Conversation

@bobbai00

@bobbai00 bobbai00 commented Jun 1, 2025 •

Copy link
Copy Markdown
Contributor

This PR adds the GuiConfig endpoint and frontend handlers. The GUI will request this endpoint to load the config values from the backend webserver during the initialization. And all the usages of config item from the environment.ts have been replaced with config items from GuiConfigService.

For Developers

  • To change the values of gui-related or user-system-related config, please go to:
    • core/config/src/main/resources/user-system.conf for user-system configs
    • core/config/src/main/resources/gui.conf for gui-related configs
  • During local development, always start ConfigService located at core/config-service/src/main/scala/edu/uci/ics/texera/service/ConfigService.scala

Motivation

The current gui configuration design has some major issues.

Problem 1: 2-copy of the same configurations

Some configurations have 2 copies: one at the gui, another at the backend services. For example:
user-sys.enabled: this flag appears in both the gui in environment.default.ts:

/**
   * whether user system is enabled
*/
  userSystemEnabled: false,

and the backend in application.conf

user-sys {
    enabled = false
    enabled = ${?USER_SYS_ENABLED}
}

2-copy has lots of issues:

  • Inconsistency definition will result into undefined behaviors
  • During docker image building, backend is configured via environmental variables, but gui requires hard-coded values.

Problem 2: Feature Usability are controlled at the gui, not at the backend

Some configurations are only at the gui and control the usabilities of system features

   /**
   * whether hub feature is enabled
   */
  hubEnabled: true,

  /**
   * whether forum feature is enabled
   */
  forumEnabled: false,

  /**
   * whether project feature is enabled
   */
  projectEnabled: false,

Toggling these values will make the corresponding components appearing/disappearing.

But the problems are

  • The corresponding endpoints are still being hosted at the backend
  • Users can modify the flag at the browser(maybe maliciously) and use these features.
    These problems can result into undefined behaviors

One naive solution is: add the same configuration to the backend. This will fallback to the 2-copy issue

Solution

  • Move the necessary configuration from gui to the backend
  • Have the endpoint(s) to send the configuration to the frontend

Benefit

  • Solve the 2-copy issue and security issue
  • In the future, we can enable
    • Hot-reloading the system features by the system admin
    • Fine-grained controls of the feature availability, e.g. per user

Design Details

1. How many endpoints should be there?

2 endpoints,

  • /api/config/gui: return all the configs related to gui
  • /api/config/user-system: return configs related to user-system

2. Which backend micro service should host the endpoint(s)?

A separate micro service, ConfigService, has been created. It loads the conf files in core/conf module and hosts two endpoints mentioned above.

3. Where the configurations should be stored?

Currently they are stored in the core/conf/src/main/resources. In the future, if there are needs of changing the config, we will add the persistency using database.

4. How gui should fetch the configurations

Configs are fetched once by the GuiConfigService at the frontend. In the future, if we introduce the modification of the configurations, we should consider persisting them in the database.

Implementation Details

Backend Services

Two sub modules have been added to the core:

  • core/conf: holds the configuration files and readers of the configurations
  • core/config-service: hosts the endpoints of reading the configuration files

Deployment

deployment/k8s/texera-helmchart has been updated to have the environment variables for gui setting.

Frontend

  • environment.default.ts has been cleared to only have production flag and the apiEndpoint string.
  • A new service, core/gui/src/app/common/service/gui-config.service.ts, has been introduced to load the config from the. backend.
  • A new type definition, core/gui/src/app/common/type/gui-config.ts has been introduced to contain the configs names and types.
  • A new mock service, core/gui/src/app/common/service/gui-config.service.mock.ts, has been added and only used during the unit testing.

Future Plan after this PR

  1. A subsequent PR will be raised to move all the conf files to core/conf/src/main/resources, including application.conf, storage.conf, auth.conf
  2. The Step1 and Step2 of wikis will be refactored based on the latest configuration structures.

@bobbai00 bobbai00 changed the title Replace static environment configs in GUI with GuiConfigService that requests the backend endpoint Move environment configurations in gui to application.conf and read via the http request Jun 1, 2025
@bobbai00 bobbai00 self-assigned this Jun 1, 2025

@aglinxinyuan aglinxinyuan left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left some major comments. There are numerous changes unrelated to the config move that aren’t mentioned in the PR title or description.
Please also highlight the design used in the PR description.

Comment thread core/gui/proxy.config.json Resolved
Comment thread core/gui/src/app/app-routing.module.ts Resolved
Comment thread core/gui/src/app/app-routing.module.ts Resolved
Comment thread core/gui/src/app/app-routing.module.ts Resolved
Comment thread core/gui/src/index.html Resolved

@aglinxinyuan aglinxinyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Please also get approval from @shengquan-ni for backend changes.

@bobbai00 bobbai00 added the config Pull requests that update configuration label Jun 9, 2025
@bobbai00
bobbai00 force-pushed the jiadong-move-config-to-backend branch from 2922d6b to 9d58028 Compare June 9, 2025 05:37
@bobbai00 bobbai00 changed the title Move environment configurations in gui to application.conf and read via the http request Move gui and user-system configurations to core/conf and host endpoints for retrieving configs via core/config-service Jun 9, 2025
@bobbai00 bobbai00 changed the title Move gui and user-system configurations to core/conf and host endpoints for retrieving configs via core/config-service Move gui and user-system configurations to core/conf and host config-retrieval endpoints via core/config-service Jun 9, 2025
@bobbai00 bobbai00 changed the title Move gui and user-system configurations to core/conf and host config-retrieval endpoints via core/config-service Move gui and user-system configurations to core/config and host config-retrieval endpoints via core/config-service Jun 10, 2025
@bobbai00
bobbai00 merged commit 704c335 into master Jun 10, 2025
@bobbai00
bobbai00 deleted the jiadong-move-config-to-backend branch June 10, 2025 06:31
SarahAsad23 pushed a commit to madisonmlin/texera that referenced this pull request May 20, 2026
…fig-retrieval endpoints via `core/config-service` (apache#3458)

This PR adds the `GuiConfig` endpoint and frontend handlers. The GUI
will request this endpoint to load the config values from the backend
webserver during the initialization. And all the usages of config item
from the `environment.ts` have been replaced with config items from
`GuiConfigService`.

## For Developers
- To change the values of gui-related or user-system-related config,
please go to:
- `core/config/src/main/resources/user-system.conf` for user-system
configs
  - `core/config/src/main/resources/gui.conf` for gui-related configs
- During local development, **always start `ConfigService`** located at
`core/config-service/src/main/scala/edu/uci/ics/texera/service/ConfigService.scala`

## Motivation
The current `gui` configuration design has some major issues.

### Problem 1: 2-copy of the same configurations

Some configurations have 2 copies: one at the `gui`, another at the
backend services. For example:
`user-sys.enabled`: this flag appears in both the gui in
`environment.default.ts`:
```typescript
/**
   * whether user system is enabled
*/
  userSystemEnabled: false,
```
and the backend in `application.conf`
```hocon
user-sys {
    enabled = false
    enabled = ${?USER_SYS_ENABLED}
}
```

2-copy has lots of issues:
- Inconsistency definition will result into undefined behaviors
- During docker image building, backend is configured via environmental
variables, but `gui` requires hard-coded values.

### Problem 2: Feature Usability are controlled at the `gui`, not at the
backend

Some configurations are **only** at the `gui` and control the
usabilities of system features
```typescript
   /**
   * whether hub feature is enabled
   */
  hubEnabled: true,

  /**
   * whether forum feature is enabled
   */
  forumEnabled: false,

  /**
   * whether project feature is enabled
   */
  projectEnabled: false,
```

Toggling these values will make the corresponding components
appearing/disappearing.

But the problems are
- The corresponding endpoints are still being hosted at the backend
- Users can modify the flag at the browser(maybe maliciously) and use
these features.
These problems can result into undefined behaviors

One naive solution is: add the same configuration to the backend. **This
will fallback to the 2-copy issue**


## Solution

- Move the necessary configuration from `gui` to the backend
- Have the endpoint(s) to send the configuration to the frontend

### Benefit
- Solve the 2-copy issue and security issue
- In the future, we can enable 
  - Hot-reloading the system features by the system admin
  - Fine-grained controls of the feature availability, e.g. per user 

## Design Details

### 1. How many endpoints should be there?
2 endpoints, 
- /api/config/gui: return all the configs related to gui
- /api/config/user-system: return configs related to user-system

### 2. Which backend micro service should host the endpoint(s)?
A separate micro service, `ConfigService`, has been created. It loads
the conf files in `core/conf` module and hosts two endpoints mentioned
above.

### 3. Where the configurations should be stored?
Currently they are stored in the `core/conf/src/main/resources`. In the
future, if there are needs of changing the config, we will add the
persistency using database.

### 4. How `gui` should fetch the configurations
Configs are fetched once by the `GuiConfigService` at the frontend. In
the future, if we introduce the modification of the configurations, we
should consider persisting them in the database.

## Implementation Details
### Backend Services

Two sub modules have been added to the `core`:
- `core/conf`: holds the configuration files and readers of the
configurations
- `core/config-service`: hosts the endpoints of reading the
configuration files

### Deployment

`deployment/k8s/texera-helmchart` has been updated to have the
environment variables for gui setting.

### Frontend

- `environment.default.ts` has been cleared to only have `production`
flag and the `apiEndpoint` string.
- A new service,
`core/gui/src/app/common/service/gui-config.service.ts`, has been
introduced to load the config from the. backend.
- A new type definition, `core/gui/src/app/common/type/gui-config.ts`
has been introduced to contain the configs names and types.
- A new mock service,
`core/gui/src/app/common/service/gui-config.service.mock.ts`, has been
added and only used during the unit testing.

## Future Plan after this PR
1. A subsequent PR will be raised to move all the conf files to
`core/conf/src/main/resources`, including `application.conf`,
`storage.conf`, `auth.conf`
2. The Step1 and Step2 of wikis will be refactored based on the latest
configuration structures.
yangzhang75 pushed a commit to yangzhang75/texera that referenced this pull request Jun 22, 2026
…fig-retrieval endpoints via `core/config-service` (apache#3458)

This PR adds the `GuiConfig` endpoint and frontend handlers. The GUI
will request this endpoint to load the config values from the backend
webserver during the initialization. And all the usages of config item
from the `environment.ts` have been replaced with config items from
`GuiConfigService`.

## For Developers
- To change the values of gui-related or user-system-related config,
please go to:
- `core/config/src/main/resources/user-system.conf` for user-system
configs
  - `core/config/src/main/resources/gui.conf` for gui-related configs
- During local development, **always start `ConfigService`** located at
`core/config-service/src/main/scala/edu/uci/ics/texera/service/ConfigService.scala`

## Motivation
The current `gui` configuration design has some major issues.

### Problem 1: 2-copy of the same configurations

Some configurations have 2 copies: one at the `gui`, another at the
backend services. For example:
`user-sys.enabled`: this flag appears in both the gui in
`environment.default.ts`:
```typescript
/**
   * whether user system is enabled
*/
  userSystemEnabled: false,
```
and the backend in `application.conf`
```hocon
user-sys {
    enabled = false
    enabled = ${?USER_SYS_ENABLED}
}
```

2-copy has lots of issues:
- Inconsistency definition will result into undefined behaviors
- During docker image building, backend is configured via environmental
variables, but `gui` requires hard-coded values.

### Problem 2: Feature Usability are controlled at the `gui`, not at the
backend

Some configurations are **only** at the `gui` and control the
usabilities of system features
```typescript
   /**
   * whether hub feature is enabled
   */
  hubEnabled: true,

  /**
   * whether forum feature is enabled
   */
  forumEnabled: false,

  /**
   * whether project feature is enabled
   */
  projectEnabled: false,
```

Toggling these values will make the corresponding components
appearing/disappearing.

But the problems are
- The corresponding endpoints are still being hosted at the backend
- Users can modify the flag at the browser(maybe maliciously) and use
these features.
These problems can result into undefined behaviors

One naive solution is: add the same configuration to the backend. **This
will fallback to the 2-copy issue**


## Solution

- Move the necessary configuration from `gui` to the backend
- Have the endpoint(s) to send the configuration to the frontend

### Benefit
- Solve the 2-copy issue and security issue
- In the future, we can enable 
  - Hot-reloading the system features by the system admin
  - Fine-grained controls of the feature availability, e.g. per user 

## Design Details

### 1. How many endpoints should be there?
2 endpoints, 
- /api/config/gui: return all the configs related to gui
- /api/config/user-system: return configs related to user-system

### 2. Which backend micro service should host the endpoint(s)?
A separate micro service, `ConfigService`, has been created. It loads
the conf files in `core/conf` module and hosts two endpoints mentioned
above.

### 3. Where the configurations should be stored?
Currently they are stored in the `core/conf/src/main/resources`. In the
future, if there are needs of changing the config, we will add the
persistency using database.

### 4. How `gui` should fetch the configurations
Configs are fetched once by the `GuiConfigService` at the frontend. In
the future, if we introduce the modification of the configurations, we
should consider persisting them in the database.

## Implementation Details
### Backend Services

Two sub modules have been added to the `core`:
- `core/conf`: holds the configuration files and readers of the
configurations
- `core/config-service`: hosts the endpoints of reading the
configuration files

### Deployment

`deployment/k8s/texera-helmchart` has been updated to have the
environment variables for gui setting.

### Frontend

- `environment.default.ts` has been cleared to only have `production`
flag and the `apiEndpoint` string.
- A new service,
`core/gui/src/app/common/service/gui-config.service.ts`, has been
introduced to load the config from the. backend.
- A new type definition, `core/gui/src/app/common/type/gui-config.ts`
has been introduced to contain the configs names and types.
- A new mock service,
`core/gui/src/app/common/service/gui-config.service.mock.ts`, has been
added and only used during the unit testing.

## Future Plan after this PR
1. A subsequent PR will be raised to move all the conf files to
`core/conf/src/main/resources`, including `application.conf`,
`storage.conf`, `auth.conf`
2. The Step1 and Step2 of wikis will be refactored based on the latest
configuration structures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Pull requests that update configuration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants