forked from flare-foundation/FTSO-price-provider
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
David Pangerl
committed
Sep 19, 2021
1 parent
a376433
commit ed97c87
Showing
13 changed files
with
786 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
PROJECT_SECRET=projects/flare-network-staging/secrets/data-provider-4_flare-price-provider_accountPrivateKey/versions/latest | ||
rpcUrl=wss://songbird-api.flare.network/ext/bc/C/ws | ||
RPC_URL=wss://songbird-api.flare.network/ext/bc/C/ws |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# include env files (evi1m3 extension) | ||
DOTENV_INCLUDE = .env; .deploy.env | ||
|
||
# Set to production when deploying to production | ||
NODE_ENV=development | ||
|
||
rpcUrl=ws://127.0.0.1:9650/ext/bc/C/ws | ||
|
||
accountPrivateKey=0x8cb860f6f44c45d43a1914b0c9da321dd5f9bc4e19e70686df2a1fca3d92beb8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Set to production when deploying to production | ||
NODE_ENV=production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ RUN yarn build | |
|
||
EXPOSE 3000 | ||
|
||
CMD node dist/DataProvider.js | ||
CMD node dist/DataProvider.js -c configs/config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import dotenv from "dotenv"; | ||
|
||
function dotenvInclude() | ||
{ | ||
const include = process.env.DOTENV_INCLUDE | ||
|
||
if( include===null || include===undefined ) return | ||
|
||
for(const inc of include.split( ';' ) ) | ||
{ | ||
console.log( `[dotenv include '${inc}']` ) | ||
dotenv.config( { path: inc } ); | ||
} | ||
} | ||
|
||
export function DotEnvExt() | ||
{ | ||
// initialize configuration | ||
if( process.env.DOTENV==="DEV" ) | ||
{ | ||
console.log( "[loading development env (.dev.env)]") | ||
dotenv.config( { path: ".dev.env" } ); | ||
} | ||
else | ||
{ | ||
dotenv.config(); | ||
} | ||
|
||
dotenvInclude() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { SecretManagerServiceClient } from "@google-cloud/secret-manager"; | ||
|
||
export async function fetchSecret(name: string) | ||
{ | ||
// console.log( ` * fetchSecret '${name}'`) | ||
|
||
try { | ||
|
||
const client = new SecretManagerServiceClient(); | ||
const [version] = await client.accessSecretVersion({name}); | ||
|
||
const payload = version.payload?.data?.toString(); | ||
|
||
if( !payload ) | ||
{ | ||
// throw new Error(`Failed to fetch secret "${name}"`); | ||
console.log( ` *** ERROR: failed to fetch secret "${name}"` ) | ||
|
||
return ""; | ||
} | ||
|
||
// console.log( `secret is "${payload}"` ) | ||
|
||
return payload | ||
} | ||
catch( error ) { | ||
console.log( ` *** ERROR: failed to fetch secret "${name}" ${error}` ) | ||
} | ||
|
||
return undefined | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#!/bin/bash | ||
docker build --rm --pull -f "./Dockerfile" -t "flarenetwork/flare-price-collector:latest" "." | ||
docker build --rm --pull -f "./Dockerfile" -t "flarenetwork/flare-price-provider:latest" "." | ||
|
||
docker push flarenetwork/flare-price-collector:latest | ||
docker push flarenetwork/flare-price-provider:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.