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

API Key in app.config.json ignored #20

Open
siskavera opened this issue Mar 21, 2023 · 4 comments
Open

API Key in app.config.json ignored #20

siskavera opened this issue Mar 21, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@siskavera
Copy link

Bug Report

Describe the Bug

The API Key configured in app.config.json seems to be ignored and is instead taken exclusively from the environment config (e.g. environment.prod.ts).

Expected Behavior

API Key configured in app.config.json is used by the frontend.

Observed Behavior

API Key from the environment config (e.g. environment.prod.ts) is used, even if there is a different value configured in app.config.json.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Configure an API key in app.config.json that is different from the one in the environment config
  2. Run the application
  3. Observe the headers sent with any request
  4. See that the value of the "X-Api-Key" header contains the API key configured in the environment config.

Context Information

There is an existing "TODO" in the code at line 83 of app.module.ts, but I haven't found a corresponding issue.

Possible Implementation

The value in the environment file could be taken as a default, overwritten by the app config if it is configured there.

@siskavera siskavera added the bug Something isn't working label Mar 21, 2023
@janpmeyer
Copy link
Contributor

Hey,

did you use it in combination with the MVD?

@veronikasiska
Copy link

Yes, I did

Hey,

did you use it in combination with the MVD?

@janpmeyer
Copy link
Contributor

Did you change it in the DataDashboard Config or in the MinimumViableDataspace Repo?

Bc the DataDashboard Configs are in the MVD Repo if you try to change sth.

For each company their is an own config. For example company1

@veronikasiska
Copy link

veronikasiska commented Oct 24, 2023

Hi, I changed it in the MVD repo. My issue was half a year ago though and I ended up using a workaround, because from the comment on line 81 in app.module.ts in the DataDashboard repo:

      provide: HTTP_INTERCEPTORS, multi: true, useFactory: () => {
        let i = new EdcApiKeyInterceptor();
        // TODO: read this from app.config.json??
        i.apiKey = environment.apiKey
        return i;
      }, deps: [AppConfigService]
    },

it looked like it just wasn't implemented to take a different API key.

I double-checked and the code-block still looks the same today on the main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants