Skip to content
This repository was archived by the owner on Oct 4, 2023. It is now read-only.

Make audiusBackend configurable for different environments#1670

Merged
sliptype merged 25 commits into
mainfrom
sk-audius-backend-common
Aug 4, 2022
Merged

Make audiusBackend configurable for different environments#1670
sliptype merged 25 commits into
mainfrom
sk-audius-backend-common

Conversation

@sliptype

@sliptype sliptype commented Aug 3, 2022

Copy link
Copy Markdown
Contributor

Description

  • Updates audiusBackend from using env vars to accepting parameters for configuration values. This allows us to use config in react native instead of process.env. Also refactors audiusBackend into a function instead of a static class
  • Creates audiusBackendInstance. Updates all references in web from AudiusBackend -> audiusBackendInstance. Once we have a corresponding audiusBackendInstance in native, we will probably have to pass these instances into the relevant sagas, etc.
  • Migrates all dependencies of audiusBackend to common in preparation for moving audiusBackend to common itself
  • Removes most instances of window in audiusBackend, there are still a couple but I believe they are limited to claiming rewards. We can address these when we build out screens

In following prs will:

  • Move audiusBackend into @audius/common
  • Do a pass of audiusBackend with the new libs types

Dragons

Is there anything the reviewer should be on the lookout for? Are there any dangerous changes?

Pretty big structural changes, smoke tested locally but definitely want to do some through testing once on stage

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide repro instructions & any configuration.

How will this change be monitored?

For features that are critical or could fail silently please describe the monitoring/alerting being added.

Feature Flags

Are all new features properly feature flagged? Describe added feature flags.

@dylanjeffers dylanjeffers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

awesome stuff! so just wondering if the goal is to move audius-backend to common after this?

import { Dispatch } from 'redux'

import imageProfilePicEmpty from 'assets/img/imageProfilePicEmpty2X.png'
import imageProfilePicEmpty from 'common/assets/img/imageProfilePicEmpty2X.png'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

clutch that images can be reused


if (cache) CIDCache.add(cid, url)
// Avoid garbage collection by keeping a few images in an in-mem array
const image = new Image()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this compat with native?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oooo I don't think so, good catch

Let me think about how to address this

() => {}
)

const url = nativeMobile

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nice

return NATIVE_MOBILE && process.env.REACT_APP_ENVIRONMENT === 'production'
? AUDIUS_ORIGIN
async function _getHostUrl() {
return nativeMobile && process.env.REACT_APP_ENVIRONMENT === 'production'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i kinda forget if process exits like this in native mobile, seemingly REACT_APP wouldn't since thats a CRA thing?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I just missed this one, updated now!

@nicoback2 nicoback2 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is awesome!

@sliptype sliptype merged commit d597054 into main Aug 4, 2022
@sliptype sliptype deleted the sk-audius-backend-common branch August 4, 2022 19:48
audius-infra pushed a commit that referenced this pull request Aug 6, 2022
[c3682b3] [C-780] Update AudiusBackend to work in native context (#1677) Dylan Jeffers
[398093d] [C-781] Add minimum threshold to common password check (#1684) Kyle Shanks
[5a66847] Ensure fetch calls are awaited so errors are caught (#1683) Sebastian Klingler
[d597054] Make audiusBackend configurable for different environments (#1670) Sebastian Klingler
[b5fa3fa] Fix native build with new metro-config dependencies (#1676) Dylan Jeffers
[408a425] [C-771] Update native metro-config to enable @audius/sdk (#1671) Dylan Jeffers
[afde38e] [PAY-416] Early access mode & feature flag refactor (#1654) Michael Piazza
[3b28c7e] Fix typecheck for mobile after AudiusBackend ts migration (#1672) Sebastian Klingler
[e5fbbb5] Revert "Revert "Update explore endpoints in libs to use v1 (#1539)" (#1609)" (#1669) Joseph Lee
[237784b] Default endpoints to empty array instead of null (#1665) Marcus Pasell
[175e5d6] Add ModalContentPages to stems (#1659) Marcus Pasell
[fdadaac] fix mobile menu on narrow (#1664) nicoback2
[3e2b499] Convert AudiusBackend to typescript (#1650) Sebastian Klingler
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants