Skip to content

Commit

Permalink
Update Auth env
Browse files Browse the repository at this point in the history
  • Loading branch information
olehmell committed Apr 25, 2024
1 parent 64fac35 commit f4f1264
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions deployment/overlays/production/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ data:
FAUCET_DRIP_AMOUNT: "0.05"
FAUCET_MAX_AMOUNT_TOP_UP: "0.025"
FAUCET_MNEMONIC: ""
IPFS_CLUSTER_URL: http://new-ipfs-cluster:9094
IPFS_GATEWAY_URL: https://ipfs.subsocial.network
IPFS_MAX_FILE_SIZE_BYTES: "2097152"
IPFS_CLUSTER_URL: http://new-ipfs-cluster:9094
IPFS_NODE_URL: http://new-ipfs-cluster:5001
IPFS_READ_ONLY_NODE_URL: http://new-ipfs-cluster:8080
IPFS_CRUST_AUTH: ''
IPFS_AUTH: ''
KUSAMA_NODE_URL: wss://kusama-rpc.polkadot.io
LOG_LEVEL: info
MAX_RESULTS_LIMIT: "20"
Expand Down
2 changes: 1 addition & 1 deletion deployment/overlays/staging/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data:
IPFS_MAX_FILE_SIZE_BYTES: "2097152"
IPFS_NODE_URL: https://gw-seattle.crustcloud.io
IPFS_READ_ONLY_NODE_URL: https://ipfs.subsocial.network
IPFS_CRUST_AUTH: eyJkYXRhIjp7ImRvbWFpbiI6eyJjaGFpbklkIjoiNSIsIm5hbWUiOiJDbG91ZDMuY2MiLCJ2ZXJpZnlpbmdDb250cmFjdCI6IjB4Q2NDQ2NjY2NDQ0NDY0NDQ0NDQ2NDY0NjY0NjQ0NDY0NjY2NjY2NjQyIsInZlcnNpb24iOiIxIn0sIm1lc3NhZ2UiOnsiZGVzY3JpcHRpb24iOiJTaWduIGZvciBXMyBCdWNrZXQgQWNjZXNzIEF1dGhlbnRpY2F0aW9uIiwic2lnbmluZ0FkZHJlc3MiOiI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diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ES_NODE_URL='https://104.248.94.114:9200'
IPFS_NODE_URL='https://gw-seattle.crustcloud.io'
IPFS_READ_ONLY_NODE_URL='https://ipfs.subsocial.network'
IPFS_CLUSTER_URL='https://test-pin.crustcloud.io/psa'
IPFS_CRUST_AUTH='eyJkYXRhIjp7ImRvbWFpbiI6eyJjaGFpbklkIjoiNSIsIm5hbWUiOiJDbG91ZDMuY2MiLCJ2ZXJpZnlpbmdDb250cmFjdCI6IjB4Q2NDQ2NjY2NDQ0NDY0NDQ0NDQ2NDY0NjY0NjQ0NDY0NjY2NjY2NjQyIsInZlcnNpb24iOiIxIn0sIm1lc3NhZ2UiOnsiZGVzY3JpcHRpb24iOiJTaWduIGZvciBXMyBCdWNrZXQgQWNjZXNzIEF1dGhlbnRpY2F0aW9uIiwic2lnbmluZ0FkZHJlc3MiOiIweDAwNDFjNzA1ZTEwNmVlOWRFMjI3Q2ExMzlBZDRBOTlEQjY0NENCM2EiLCJ0b2tlbkFkZHJlc3MiOiIweDM5ODY2Mzg0MjY4MDMzMkExQWJBM0IwM2JkNmRCNDdhRTk4NDk5NEMiLCJ0b2tlbklkIjoiMzAwMDAzNyIsImVmZmVjdGl2ZVRpbWVzdGFtcCI6MTY3ODUzNzYxNywiZXhwaXJhdGlvblRpbWVzdGFtcCI6MH0sInByaW1hcnlUeXBlIjoiVzNCdWNrZXQiLCJ0eXBlcyI6eyJXM0J1Y2tldCI6W3sibmFtZSI6ImRlc2NyaXB0aW9uIiwidHlwZSI6InN0cmluZyJ9LHsibmFtZSI6InNpZ25pbmdBZGRyZXNzIiwidHlwZSI6ImFkZHJlc3MifSx7Im5hbWUiOiJ0b2tlbkFkZHJlc3MiLCJ0eXBlIjoiYWRkcmVzcyJ9LHsibmFtZSI6InRva2VuSWQiLCJ0eXBlIjoic3RyaW5nIn0seyJuYW1lIjoiZWZmZWN0aXZlVGltZXN0YW1wIiwidHlwZSI6InVpbnQyNTYifSx7Im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FtZSI6InRva2VuSWQiLCJ0eXBlIjoic3RyaW5nIn0seyJuYW1lIjoiZWZmZWN0aXZlVGltZXN0YW1wIiwidHlwZSI6InVpbnQyNTYifSx7Im5hbWUiOiJleHBpcmF0aW9uVGltZXN0YW1wIiwidHlwZSI6InVpbnQyNTYifV19fSwic2lnbmF0dXJlIjoiMHhhMTUxODkyZGNhMTZlMTJkZmViYTFjY2FkMjNmZjM5MGVmODQ1MzdhMGI2MWI4YWQ1NDY1ZGI1ZjI1NjZkMWJmMjc3MGE1OTQyMzFmNzFmYzA5YWVlZGJhNzJkZjM5Y2Y4NDIxMTQ3YzJkNWQyNTFkNDZjNGQyMDFlOGM1MmUzZTFjIn0='

# Max size (in MB) of a file that can be added to our IPFS node.
IPFS_MAX_FILE_SIZE_BYTES=2097152
Expand Down
2 changes: 1 addition & 1 deletion src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const substrateNodeUrl = process.env.SUBSTRATE_URL
export const ipfsReadOnlyNodeUrl = process.env.IPFS_READ_ONLY_NODE_URL || 'http://localhost:8080'
export const ipfsNodeUrl = process.env.IPFS_NODE_URL || 'http://localhost:5001'
export const ipfsClusterUrl = process.env.IPFS_CLUSTER_URL || 'http://localhost:9094'
export const crustIpfsAuth = process.env.IPFS_CRUST_AUTH || ''
export const ipfsAuthHeader = process.env.IPFS_AUTH || ''
export const port = process.env.OFFCHAIN_SERVER_PORT || 3001

export const corsAllowedList = process.env.CORS_ALLOWED_ORIGIN.split(',')
Expand Down
9 changes: 4 additions & 5 deletions src/ipfs/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { SubsocialIpfsApi } from '@subsocial/api'
import {crustIpfsAuth, ipfsClusterUrl, ipfsNodeUrl, ipfsReadOnlyNodeUrl} from "../env";
import {ipfsAuthHeader, ipfsClusterUrl, ipfsNodeUrl, ipfsReadOnlyNodeUrl} from "../env";

function getIpfsApi() {
const writeHeaders = crustIpfsAuth ? { authorization: crustIpfsAuth } : {}
const props = crustIpfsAuth ? { asLink: false, 'meta.gatewayId': 1 } : { asLink: true }

console.log(props)
const writeHeaders = { authorization: ipfsAuthHeader }
const isCrust = false
const props = isCrust ? { asLink: false, 'meta.gatewayId': 1 } : { asLink: true }

const ipfs = new SubsocialIpfsApi({
ipfsNodeUrl: ipfsReadOnlyNodeUrl,
Expand Down

0 comments on commit f4f1264

Please sign in to comment.