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

Refactor configuration keys out of repository #8895

Merged
merged 54 commits into from
Mar 8, 2024

Conversation

somebody1234
Copy link
Contributor

@somebody1234 somebody1234 commented Jan 30, 2024

Pull Request Description

  • Close https://github.com/enso-org/cloud-v2/issues/866
    • Remove all references to client keys and API base URLs from the codebase.
    • The app can still be built by external contributors. However, the cloud backend (among some other things) will be completely disabled, as the required keys and base URLs will be missing.
    • Add entry to .gitignore to allow *.env files in app/ide-desktop/lib/dashboard/

Important Notes

  • Tested (no .env; .env with prod backend; .pbuchu.env) on:
    • npm run dev in app/ide-desktop/lib/dashboard/
    • ./run ide build
    • ./run ide2 build
    • ./run gui watch

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@somebody1234 somebody1234 added CI: No changelog needed Do not require a changelog entry for this PR. g-dashboard x-refactor Changes that should not be visible to the end-user labels Jan 30, 2024
@somebody1234
Copy link
Contributor Author

@mwu-tow just a heads up that the relevant environment variables will need to be added to CI if this is merged in. the names of the environment variables are tentative though, so it probably won't be super urgent.

Copy link
Contributor

@farmaazon farmaazon left a comment

Choose a reason for hiding this comment

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

Approving gui2 changes.

@@ -0,0 +1,34 @@
/** @file An object containing globals to inject. */
Copy link
Contributor

Choose a reason for hiding this comment

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

I wouldn't know from docs here that this is about injecting app configuration.

@somebody1234
Copy link
Contributor Author

note: CI succeeding will not be sufficient to confirm that this works. we will need to download the built artifact and make sure it has the (correct) cloud environment visible (since it defaults to disabling cloud completely if the environment variables are not set.)

Copy link
Contributor

@mwu-tow mwu-tow left a comment

Choose a reason for hiding this comment

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

(self-reviewing the CI parts)

Copy link
Contributor

@indiv0 indiv0 left a comment

Choose a reason for hiding this comment

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

Left a few minor comments/suggestions, but LGTM overall. Should be good to merge (pending conflict resolution).

app/ide-desktop/lib/client/watch.ts Outdated Show resolved Hide resolved
throw new Error(`${errorMessage} Response: ${text}.`)
} catch (error) {
throw new Error(`${errorMessage} Failed to read response: ${String(error)}.`)
if (REMOTE_LOG_URL != null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Personally I'm a fan of early return rather than if-pyramids but I suppose that's a stylistic choice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's enforced by lints, but i agree. i kinda assumed we wanted to avoid early return because (i think) that's wojciech's preference, but we can definitely remove the lint enforcing if-pyramids - it's not like it's particularly useful. perhaps we can enforce that early return is only used at the very start though - because i guesss the point was that having returns in the middle of the function makes behavior surprising since you can easily miss it in a long function

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I do recall Wojciech prefers them, so I suppose it can stay 🤷

Copy link
Contributor

Choose a reason for hiding this comment

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

@wdanilo care to weigh in?

Comment on lines 66 to 68
throw new Error(`${errorMessage} Response: ${text}.`)
} catch (error) {
throw new Error(`${errorMessage} Failed to read response: ${String(error)}.`)
Copy link
Contributor

Choose a reason for hiding this comment

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

I realize this try/catch was here before the PR but this seems like it should be a try/catch/finally because wouldn't the first throw statement get caught by the catch and thus it'd say FOO Failed to read response: BAR Response: BAZ which is misleading since we did read the response?

app/ide-desktop/lib/dashboard/README.md Outdated Show resolved Hide resolved
app/ide-desktop/lib/dashboard/README.md Show resolved Hide resolved
app/ide-desktop/lib/dashboard/README.md Outdated Show resolved Hide resolved
app/ide-desktop/lib/dashboard/env.ts Outdated Show resolved Hide resolved
app/ide-desktop/lib/dashboard/vite.config.ts Outdated Show resolved Hide resolved
app/ide-desktop/lib/content/esbuild-config.ts Show resolved Hide resolved
@somebody1234
Copy link
Contributor Author

@mwu-tow would you possibly be able to rename the _AMPLIFY_ environment variables to _COGNITO_ instead, in the github variables?

@somebody1234
Copy link
Contributor Author

should be ready to merge now but avoiding the merge until the env vars are updated on the GH side.

@somebody1234 somebody1234 mentioned this pull request Mar 6, 2024
5 tasks
@mwu-tow
Copy link
Contributor

mwu-tow commented Mar 6, 2024

@mwu-tow would you possibly be able to rename the _AMPLIFY_ environment variables to _COGNITO_ instead, in the github variables?

@somebody1234 I've applied the renames:
ENSO_CLOUD_AMPLIFY_DOMAIN -> ENSO_CLOUD_COGNITO_DOMAIN
ENSO_CLOUD_AMPLIFY_REGION -> ENSO_CLOUD_COGNITO_REGION
ENSO_CLOUD_AMPLIFY_USER_POOL_ID -> ENSO_CLOUD_COGNITO_USER_POOL_ID
ENSO_CLOUD_AMPLIFY_USER_POOL_WEB_CLIENT_ID -> ENSO_CLOUD_COGNITO_USER_POOL_WEB_CLIENT_ID

@somebody1234 somebody1234 added the CI: Ready to merge This PR is eligible for automatic merge label Mar 6, 2024
@mergify mergify bot merged commit d2f6b10 into develop Mar 8, 2024
31 of 34 checks passed
@mergify mergify bot deleted the wip/sb/refactor-configuration-keys branch March 8, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge g-dashboard x-refactor Changes that should not be visible to the end-user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants