Skip to content

Commit

Permalink
chore: reduce chance of mistake with environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Aug 31, 2024
1 parent b7ab716 commit 373fbfa
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ Open [http://localhost:3000](http://localhost:3000) with your browser to see the
4. Open a terminal and navigate to the folder your fly.toml is in. Run `fly launch`
5. Set your fly secrets: `fly secrets set ALBYHUB_URL="your-albyhub-url.example.com" AUTH_TOKEN="eyJhbGciOiJIUzI1NiIsInR5c....RvM" BASE_URL="https://YOURAPPNAME.fly.dev"`.

> `BASE_URL` is the URL where you will host your Jim app.
> If you use Alby Cloud, you also need to set `ALBYHUB_NAME="YOUR_ALBYHUB_NAME"` to route requests to your specific hub.
> You can get the ALBYHUB_URL, AUTH_TOKEN and ALBYHUB_NAME by logging into Alby Hub and Going to settings -> Developer.
Expand Down
2 changes: 1 addition & 1 deletion app/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export async function getInfo() {
function getHeaders() {
return {
Authorization: `Bearer ${process.env.AUTH_TOKEN}`,
"AlbyHub-Name": process.env.ALBYHUB_NAME || "",
"AlbyHub-Name": process.env.ALBYHUB_NAME || process.env.ALBY_HUB_NAME || "",
"Content-Type": "application/json",
Accept: "application/json",
};
Expand Down
7 changes: 4 additions & 3 deletions app/utils.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
export function getAlbyHubUrl() {
if (!process.env.ALBYHUB_URL) {
throw new Error("No BASE_URL set");
const albyHubUrl = process.env.ALBYHUB_URL || process.env.ALBY_HUB_URL;
if (!albyHubUrl) {
throw new Error("No ALBYHUB_URL set");
}
return removeTrailingSlash(process.env.ALBYHUB_URL);
return removeTrailingSlash(albyHubUrl);
}

export function getBaseUrl() {
Expand Down

0 comments on commit 373fbfa

Please sign in to comment.