Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Read Replit DB URL from file#42

Merged
brenoafb merged 3 commits intomasterfrom
bb04-07-Read_Replit_DB_URL_from_file
Apr 7, 2023
Merged

Read Replit DB URL from file#42
brenoafb merged 3 commits intomasterfrom
bb04-07-Read_Replit_DB_URL_from_file

Conversation

@brenoafb
Copy link
Contributor

@brenoafb brenoafb commented Apr 7, 2023

Why

The JWT used for authenticating into the Replit DB is placed on the Repl as an environment variable on boot and lasts for 30h or so. This is fine for shorter lasting Repls, but if we want to have long-running Repls we need a mechanism to refresh the DB token.

What changed

Let's make it so that we read the DB URL data from a file, which can be refreshed while a program is running. If the file does not exist or we fail to read from it, fall back to the environment variable.

Testing

We need to set the RIDT_PASSWORD to the token used for authing into database-test-ridt.util.repl.co. You can find it in that Repl's secrets. To store the database URL in a file instead of the env var, set the USE_FILE environment variable to anything.

USE_FILE=1 RIDT_PASSWORD=<PASSWORD> npm test

Copy link
Contributor Author

brenoafb commented Apr 7, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@brenoafb brenoafb changed the base branch from master to bb04-07-Change_Repl_used_for_fetching_DB_token_in_tests April 7, 2023 17:45
@brenoafb brenoafb force-pushed the bb04-07-Read_Replit_DB_URL_from_file branch from 377680d to 5bcf459 Compare April 7, 2023 17:45
@brenoafb brenoafb force-pushed the bb04-07-Read_Replit_DB_URL_from_file branch 2 times, most recently from 59548c8 to 8b6f9d3 Compare April 7, 2023 18:08
@brenoafb brenoafb marked this pull request as ready for review April 7, 2023 18:23
Base automatically changed from bb04-07-Change_Repl_used_for_fetching_DB_token_in_tests to master April 7, 2023 18:27
@brenoafb brenoafb force-pushed the bb04-07-Read_Replit_DB_URL_from_file branch from 8b6f9d3 to 5032635 Compare April 7, 2023 18:28
@brenoafb brenoafb merged commit 709df59 into master Apr 7, 2023
@brenoafb brenoafb deleted the bb04-07-Read_Replit_DB_URL_from_file branch April 7, 2023 18:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant