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

feat(indexer): Load environment variables from .env #5944

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

roninjin10
Copy link
Contributor

@roninjin10 roninjin10 commented Jun 9, 2023

  • add dotenv to automatically load .env when running outside of docker
  • This is mostly just a nice-to-have because these env variables are also used in docker-compose so it saves configuration

@roninjin10 roninjin10 requested a review from a team as a code owner June 9, 2023 05:36
@changeset-bot
Copy link

changeset-bot bot commented Jun 9, 2023

⚠️ No Changeset found

Latest commit: 538770d

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@semgrep-app
Copy link
Contributor

semgrep-app bot commented Jun 9, 2023

Semgrep found 1 use-tls finding:

  • indexer/api/api.go: L104

Found an HTTP server without TLS. Use 'http.ListenAndServeTLS' instead. See https://golang.org/pkg/net/http/#ListenAndServeTLS for more information.

Ignore this finding from use-tls.

Copy link
Contributor

@hamdiallam hamdiallam left a comment

Choose a reason for hiding this comment

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

Why do we have a .env & also a toml configuration?

@roninjin10
Copy link
Contributor Author

roninjin10 commented Jun 9, 2023

@hamdiallam you don't need a .env unless your toml file has environment variables in it. OUrs does for example here.

This is also why we don't panic when no .env is found. It's perfectly normal to use the toml file without environment variables or to pass in environment variables in a way other than .env

[rpcs]
l1-rpc = "${INDEXER_RPC_URL_L1}"
l2-rpc = "${INDEXER_RPC_URL_L2}"

@roninjin10
Copy link
Contributor Author

We also need a .env file for docker-compose but that's unrelated to this pr

@semgrep-app
Copy link
Contributor

semgrep-app bot commented Jun 9, 2023

Semgrep found 12 todos_require_linear findings:

  • packages/data-transport-layer/src/services/l1-ingestion/service.ts: L167
  • packages/data-transport-layer/src/utils/contracts.ts: L75
  • packages/data-transport-layer/src/db/simple-db.ts: L10, L37
  • packages/data-transport-layer/src/services/main/service.ts: L121
  • packages/data-transport-layer/src/services/server/service.ts: L138, L226, L227, L228
  • packages/data-transport-layer/src/services/l1-ingestion/handlers/sequencer-batch-appended.ts: L34, L88
  • packages/data-transport-layer/src/utils/validation.ts: L41

Please create a Linear ticket for this TODO.

Ignore this finding from todos_require_linear.

Base automatically changed from willc/api-listen-fix to develop June 9, 2023 19:38
@roninjin10 roninjin10 changed the base branch from develop to willc/makefile June 10, 2023 01:31
@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2023

This PR is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jul 1, 2023
@github-actions github-actions bot closed this Jul 7, 2023
@roninjin10 roninjin10 reopened this Aug 11, 2023
@mergify
Copy link
Contributor

mergify bot commented Aug 11, 2023

Hey @roninjin10! This PR has merge conflicts. Please fix them before continuing review.

indexer/config/config.go Show resolved Hide resolved
@mergify
Copy link
Contributor

mergify bot commented Aug 11, 2023

Hey @roninjin10! This PR has merge conflicts. Please fix them before continuing review.

Copy link
Contributor

@Inphi Inphi left a comment

Choose a reason for hiding this comment

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

I'm not a fan of implicit configuration. It's too easy for users to accidentally leave a .env in their workspace and deploy that without easily knowing how the app behaves.

Though in our case, it seems fine since we use docker builds. But in general, I don't think this is good practice (including usage in the typescript BaseService apps)

@OptimismBot OptimismBot merged commit fa9a547 into develop Aug 14, 2023
4 of 5 checks passed
@OptimismBot OptimismBot deleted the willc/dotenv branch August 14, 2023 17:09
@mergify
Copy link
Contributor

mergify bot commented Aug 14, 2023

This PR has been added to the merge queue, and will be merged soon.

@mergify
Copy link
Contributor

mergify bot commented Aug 14, 2023

This PR is next in line to be merged, and will be merged as soon as checks pass.

@mergify mergify bot removed the on-merge-train label Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-indexer Area: indexer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants