mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
move IPFS config for client & server
This commit is contained in:
parent
c63325bdf2
commit
e3be76fb95
@ -26,6 +26,12 @@ env:
|
|||||||
- REACT_APP_SECRET_STORE_URI="http://localhost:12001"
|
- REACT_APP_SECRET_STORE_URI="http://localhost:12001"
|
||||||
- REACT_APP_FAUCET_URI="http://localhost:3001"
|
- REACT_APP_FAUCET_URI="http://localhost:3001"
|
||||||
- REACT_APP_BRIZO_ADDRESS="0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0"
|
- REACT_APP_BRIZO_ADDRESS="0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0"
|
||||||
|
|
||||||
|
# IPFS client & server config
|
||||||
|
- REACT_APP_IPFS_GATEWAY_URI="https://ipfs.dev-ocean.com"
|
||||||
|
# - REACT_APP_IPFS_NODE_URI="https://ipfs.dev-ocean.com:5050"
|
||||||
|
- IPFS_GATEWAY_URI="https://ipfs.dev-ocean.com"
|
||||||
|
|
||||||
# start Barge with these versions
|
# start Barge with these versions
|
||||||
- BRIZO_VERSION=v0.4.4
|
- BRIZO_VERSION=v0.4.4
|
||||||
- AQUARIUS_VERSION=v0.3.8
|
- AQUARIUS_VERSION=v0.3.8
|
||||||
|
@ -59,4 +59,5 @@ REACT_APP_REPORT_EMAIL="test@example.com"
|
|||||||
# REACT_APP_SHOW_CHANNELS=true
|
# REACT_APP_SHOW_CHANNELS=true
|
||||||
# REACT_APP_ALLOW_PRICING=true
|
# REACT_APP_ALLOW_PRICING=true
|
||||||
# REACT_APP_SHOW_REQUEST_TOKENS_BUTTON=true
|
# REACT_APP_SHOW_REQUEST_TOKENS_BUTTON=true
|
||||||
# REACT_APP_IPFS_GATEWAY_URI="https://gateway.ipfs.io"
|
# REACT_APP_IPFS_GATEWAY_URI="https://ipfs.oceanprotocol.com"
|
||||||
|
# REACT_APP_IPFS_NODE_URI="https://ipfs.oceanprotocol.com:5050"
|
||||||
|
@ -38,3 +38,6 @@ export const showRequestTokens =
|
|||||||
// https://ipfs.github.io/public-gateway-checker/
|
// https://ipfs.github.io/public-gateway-checker/
|
||||||
export const ipfsGatewayUri =
|
export const ipfsGatewayUri =
|
||||||
process.env.REACT_APP_IPFS_GATEWAY_URI || 'https://gateway.ipfs.io'
|
process.env.REACT_APP_IPFS_GATEWAY_URI || 'https://gateway.ipfs.io'
|
||||||
|
|
||||||
|
export const ipfsNodeUri =
|
||||||
|
process.env.REACT_APP_IPFS_NODE_URI || 'https://ipfs.infura.io:5001'
|
||||||
|
@ -7,11 +7,13 @@ export default function Form({
|
|||||||
children,
|
children,
|
||||||
ipfsMessage,
|
ipfsMessage,
|
||||||
ipfsError,
|
ipfsError,
|
||||||
|
isIpfsReady,
|
||||||
error
|
error
|
||||||
}: {
|
}: {
|
||||||
children: any
|
children: any
|
||||||
ipfsMessage: string
|
ipfsMessage: string
|
||||||
ipfsError?: string
|
ipfsError?: string
|
||||||
|
isIpfsReady: boolean
|
||||||
error?: string
|
error?: string
|
||||||
}) {
|
}) {
|
||||||
return (
|
return (
|
||||||
@ -20,7 +22,11 @@ export default function Form({
|
|||||||
Add File To IPFS
|
Add File To IPFS
|
||||||
</Label>
|
</Label>
|
||||||
{children}
|
{children}
|
||||||
<Status message={ipfsMessage} error={ipfsError || error} />
|
<Status
|
||||||
|
message={ipfsMessage}
|
||||||
|
isIpfsReady={isIpfsReady}
|
||||||
|
error={ipfsError || error}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,18 @@
|
|||||||
width: .5rem;
|
width: .5rem;
|
||||||
height: .5rem;
|
height: .5rem;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
background: $green;
|
background: $yellow;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
margin-right: $spacer / 4;
|
margin-right: $spacer / 6;
|
||||||
margin-bottom: .05rem;
|
margin-bottom: .1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.success {
|
||||||
|
composes: message;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
background: $green;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,17 @@ import styles from './Status.module.scss'
|
|||||||
|
|
||||||
export default function Status({
|
export default function Status({
|
||||||
message,
|
message,
|
||||||
error
|
error,
|
||||||
|
isIpfsReady
|
||||||
}: {
|
}: {
|
||||||
message: string
|
message: string
|
||||||
error?: string
|
error?: string
|
||||||
|
isIpfsReady: boolean
|
||||||
}) {
|
}) {
|
||||||
const classes = error ? styles.error : styles.message
|
const classes = isIpfsReady
|
||||||
|
? styles.success
|
||||||
|
: error
|
||||||
|
? styles.error
|
||||||
|
: styles.message
|
||||||
return <div className={classes}>{message}</div>
|
return <div className={classes}>{message}</div>
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,19 @@ import useIpfsApi, { IpfsConfig } from '../../../../hooks/use-ipfs-api'
|
|||||||
import Spinner from '../../../../components/atoms/Spinner'
|
import Spinner from '../../../../components/atoms/Spinner'
|
||||||
import Dropzone from '../../../../components/molecules/Dropzone'
|
import Dropzone from '../../../../components/molecules/Dropzone'
|
||||||
import { formatBytes, pingUrl, readFileAsync } from '../../../../utils/utils'
|
import { formatBytes, pingUrl, readFileAsync } from '../../../../utils/utils'
|
||||||
import { ipfsGatewayUri } from '../../../../config'
|
import { ipfsGatewayUri, ipfsNodeUri } from '../../../../config'
|
||||||
import Form from './Form'
|
import Form from './Form'
|
||||||
|
|
||||||
const config: IpfsConfig = {
|
const { hostname, port, protocol } = new URL(ipfsNodeUri)
|
||||||
host: 'ipfs.infura.io',
|
|
||||||
port: '5001',
|
const ipfsConfig: IpfsConfig = {
|
||||||
protocol: 'https'
|
host: hostname,
|
||||||
|
port,
|
||||||
|
protocol: protocol.replace(':', '')
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Ipfs({ addFile }: { addFile(url: string): void }) {
|
export default function Ipfs({ addFile }: { addFile(url: string): void }) {
|
||||||
const { ipfs, isIpfsReady, ipfsError, ipfsMessage } = useIpfsApi(config)
|
const { ipfs, isIpfsReady, ipfsError, ipfsMessage } = useIpfsApi(ipfsConfig)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [message, setMessage] = useState('')
|
const [message, setMessage] = useState('')
|
||||||
const [fileSize, setFileSize] = useState('')
|
const [fileSize, setFileSize] = useState('')
|
||||||
@ -80,7 +82,12 @@ export default function Ipfs({ addFile }: { addFile(url: string): void }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Form error={error} ipfsMessage={ipfsMessage} ipfsError={ipfsError}>
|
<Form
|
||||||
|
error={error}
|
||||||
|
ipfsMessage={ipfsMessage}
|
||||||
|
ipfsError={ipfsError}
|
||||||
|
isIpfsReady={isIpfsReady}
|
||||||
|
>
|
||||||
{loading ? (
|
{loading ? (
|
||||||
<Spinner message={message} />
|
<Spinner message={message} />
|
||||||
) : (
|
) : (
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
SENDGRID_API_KEY='xxx'
|
SENDGRID_API_KEY='xxx'
|
||||||
IPFS_GATEWAY_URL='https://gateway.ipfs.io'
|
IPFS_GATEWAY_URI='https://ipfs.dev-ocean.com'
|
||||||
|
@ -3,7 +3,7 @@ import 'dotenv/config'
|
|||||||
const config = {
|
const config = {
|
||||||
app: { port: 4000 },
|
app: { port: 4000 },
|
||||||
sendgridApiKey: process.env.SENDGRID_API_KEY,
|
sendgridApiKey: process.env.SENDGRID_API_KEY,
|
||||||
ipfsGatewayUrl: process.env.IPFS_GATEWAY_URL || 'https://gateway.ipfs.io'
|
ipfsGatewayUri: process.env.IPFS_GATEWAY_URI || 'https://gateway.ipfs.io'
|
||||||
}
|
}
|
||||||
|
|
||||||
export default config
|
export default config
|
||||||
|
@ -22,7 +22,7 @@ export class UrlCheckRouter {
|
|||||||
// map native IPFS URLs to gateway URLs
|
// map native IPFS URLs to gateway URLs
|
||||||
if (url.includes('ipfs://')) {
|
if (url.includes('ipfs://')) {
|
||||||
const cid = url.split('ipfs://')[1]
|
const cid = url.split('ipfs://')[1]
|
||||||
url = `${config.ipfsGatewayUrl}/ipfs/${cid}`
|
url = `${config.ipfsGatewayUri}/ipfs/${cid}`
|
||||||
}
|
}
|
||||||
|
|
||||||
request(
|
request(
|
||||||
|
Loading…
Reference in New Issue
Block a user