How to use the env-var.get function in env-var

To help you get started, weโ€™ve selected a few env-var examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Ethercast / serverless-blockstream / src / util / env.ts View on Github external
import * as env from 'env-var';
import { LogLevel } from 'bunyan';

export const SRC_NODE_URL: string = env.get('SRC_NODE_URL').required().asUrlString();
export const NETWORK_ID: number = env.get('NETWORK_ID').required().asIntPositive();

export const LOG_LEVEL: LogLevel = env.get('LOG_LEVEL').required().asString() as LogLevel;

export const BLOCK_DATA_TTL_MS: number = env.get('BLOCK_DATA_TTL_MS').required().asIntPositive();

// OWNED RESOURCES
export const BLOCKS_TABLE: string = env.get('BLOCKS_TABLE').required().asString();
export const BLOCKSTREAM_STATE_TABLE: string = env.get('BLOCKSTREAM_STATE_TABLE').required().asString();
export const ABI_TABLE: string = env.get('ABI_TABLE').required().asString();

export const NEW_BLOCK_QUEUE_NAME: string = env.get('NEW_BLOCK_QUEUE_NAME').required().asString();
export const LOG_FIREHOSE_QUEUE_NAME: string = env.get('LOG_FIREHOSE_QUEUE_NAME').required().asString();
export const TRANSACTION_FIREHOSE_QUEUE_NAME: string = env.get('TRANSACTION_FIREHOSE_QUEUE_NAME').required().asString();

export const BLOCK_READY_TOPIC_NAME: string = env.get('BLOCK_READY_TOPIC_NAME').required().asString();
export const BLOCK_PROCESSED_TOPIC_NAME: string = env.get('BLOCK_PROCESSED_TOPIC_NAME').required().asString();

export const NUM_BLOCKS_DELAY: number = env.get('NUM_BLOCKS_DELAY').required().asIntPositive();

export const REWIND_BLOCK_LOOKBACK: number = env.get('REWIND_BLOCK_LOOKBACK').required().asIntPositive();

export const ETHERSCAN_API_URL: string = env.get('ETHERSCAN_API_URL').required().asUrlString();
export const ETHERSCAN_API_KEY: string = env.get('ETHERSCAN_API_KEY').required().asString();
github RedHatWorkshops / dayinthelife-streaming / projects / module-1-ui-web / server / index.js View on Github external
'use strict'

require('make-promises-safe')

const http = require('http')
const exphbs = require('express-handlebars')
const express = require('express')
const env = require('env-var')
const probe = require('kube-probe')
const { join } = require('path')
const wssOutgoing = require('./ws-outgoing')
const log = require('./log')

const PORT = env.get('PORT', 8080).asPortNumber()
const WS_CONNECTION_STRING = env.get('WS_CONNECTION_STRING').asUrlString()

// Create an express app, attach it to a http server,
// and bind a websocket server to the same socket
const app = express()
const server = http.createServer(app)

// Kubernetes liveness readiness probes
probe(app)

app.engine('handlebars', exphbs())
app.set('views', join(__dirname, '/views'))
app.set('view engine', 'handlebars')

app.get('/', (req, res) => {
  res.render('home.handlebars', {
github aws-samples / reinvent2018-dev303-code / src / frontend / routes / product.js View on Github external
.then(value => {
        var products = value.data;

        // fetch recommendations next, ignore errors here
        axios_client
          .get(
            "http://" +
              env.get("RECOMMENDER_ENDPOINT").asString() +
              "/api/v1/recommender/" +
              product_id
          )
          .then(v => {
            var rec = v.data['recommendations'];
            render(res, req, products, rec);
          })
          .catch(error => {
            render(res, req, products, undefined);
          });
      })
      .catch(e => {
github Ethercast / serverless-blockstream / src / util / env.ts View on Github external
import * as env from 'env-var';
import { LogLevel } from 'bunyan';

export const SRC_NODE_URL: string = env.get('SRC_NODE_URL').required().asUrlString();
export const NETWORK_ID: number = env.get('NETWORK_ID').required().asIntPositive();

export const LOG_LEVEL: LogLevel = env.get('LOG_LEVEL').required().asString() as LogLevel;

export const BLOCK_DATA_TTL_MS: number = env.get('BLOCK_DATA_TTL_MS').required().asIntPositive();

// OWNED RESOURCES
export const BLOCKS_TABLE: string = env.get('BLOCKS_TABLE').required().asString();
export const BLOCKSTREAM_STATE_TABLE: string = env.get('BLOCKSTREAM_STATE_TABLE').required().asString();
export const ABI_TABLE: string = env.get('ABI_TABLE').required().asString();

export const NEW_BLOCK_QUEUE_NAME: string = env.get('NEW_BLOCK_QUEUE_NAME').required().asString();
export const LOG_FIREHOSE_QUEUE_NAME: string = env.get('LOG_FIREHOSE_QUEUE_NAME').required().asString();
export const TRANSACTION_FIREHOSE_QUEUE_NAME: string = env.get('TRANSACTION_FIREHOSE_QUEUE_NAME').required().asString();

export const BLOCK_READY_TOPIC_NAME: string = env.get('BLOCK_READY_TOPIC_NAME').required().asString();
export const BLOCK_PROCESSED_TOPIC_NAME: string = env.get('BLOCK_PROCESSED_TOPIC_NAME').required().asString();

export const NUM_BLOCKS_DELAY: number = env.get('NUM_BLOCKS_DELAY').required().asIntPositive();

export const REWIND_BLOCK_LOOKBACK: number = env.get('REWIND_BLOCK_LOOKBACK').required().asIntPositive();

export const ETHERSCAN_API_URL: string = env.get('ETHERSCAN_API_URL').required().asUrlString();
export const ETHERSCAN_API_KEY: string = env.get('ETHERSCAN_API_KEY').required().asString();
github Ethercast / serverless-blockstream / src / util / env.ts View on Github external
import * as env from 'env-var';
import { LogLevel } from 'bunyan';

export const SRC_NODE_URL: string = env.get('SRC_NODE_URL').required().asUrlString();
export const NETWORK_ID: number = env.get('NETWORK_ID').required().asIntPositive();

export const LOG_LEVEL: LogLevel = env.get('LOG_LEVEL').required().asString() as LogLevel;

export const BLOCK_DATA_TTL_MS: number = env.get('BLOCK_DATA_TTL_MS').required().asIntPositive();

// OWNED RESOURCES
export const BLOCKS_TABLE: string = env.get('BLOCKS_TABLE').required().asString();
export const BLOCKSTREAM_STATE_TABLE: string = env.get('BLOCKSTREAM_STATE_TABLE').required().asString();
export const ABI_TABLE: string = env.get('ABI_TABLE').required().asString();

export const NEW_BLOCK_QUEUE_NAME: string = env.get('NEW_BLOCK_QUEUE_NAME').required().asString();
export const LOG_FIREHOSE_QUEUE_NAME: string = env.get('LOG_FIREHOSE_QUEUE_NAME').required().asString();
export const TRANSACTION_FIREHOSE_QUEUE_NAME: string = env.get('TRANSACTION_FIREHOSE_QUEUE_NAME').required().asString();

export const BLOCK_READY_TOPIC_NAME: string = env.get('BLOCK_READY_TOPIC_NAME').required().asString();
export const BLOCK_PROCESSED_TOPIC_NAME: string = env.get('BLOCK_PROCESSED_TOPIC_NAME').required().asString();
github Ethercast / serverless-blockstream / src / util / env.ts View on Github external
import * as env from 'env-var';
import { LogLevel } from 'bunyan';

export const SRC_NODE_URL: string = env.get('SRC_NODE_URL').required().asUrlString();
export const NETWORK_ID: number = env.get('NETWORK_ID').required().asIntPositive();

export const LOG_LEVEL: LogLevel = env.get('LOG_LEVEL').required().asString() as LogLevel;

export const BLOCK_DATA_TTL_MS: number = env.get('BLOCK_DATA_TTL_MS').required().asIntPositive();

// OWNED RESOURCES
export const BLOCKS_TABLE: string = env.get('BLOCKS_TABLE').required().asString();
export const BLOCKSTREAM_STATE_TABLE: string = env.get('BLOCKSTREAM_STATE_TABLE').required().asString();
export const ABI_TABLE: string = env.get('ABI_TABLE').required().asString();

export const NEW_BLOCK_QUEUE_NAME: string = env.get('NEW_BLOCK_QUEUE_NAME').required().asString();
export const LOG_FIREHOSE_QUEUE_NAME: string = env.get('LOG_FIREHOSE_QUEUE_NAME').required().asString();
export const TRANSACTION_FIREHOSE_QUEUE_NAME: string = env.get('TRANSACTION_FIREHOSE_QUEUE_NAME').required().asString();

export const BLOCK_READY_TOPIC_NAME: string = env.get('BLOCK_READY_TOPIC_NAME').required().asString();
export const BLOCK_PROCESSED_TOPIC_NAME: string = env.get('BLOCK_PROCESSED_TOPIC_NAME').required().asString();

export const NUM_BLOCKS_DELAY: number = env.get('NUM_BLOCKS_DELAY').required().asIntPositive();

export const REWIND_BLOCK_LOOKBACK: number = env.get('REWIND_BLOCK_LOOKBACK').required().asIntPositive();

export const ETHERSCAN_API_URL: string = env.get('ETHERSCAN_API_URL').required().asUrlString();
export const ETHERSCAN_API_KEY: string = env.get('ETHERSCAN_API_KEY').required().asString();
github aws-samples / reinvent2018-dev303-code / src / frontend / routes / product.js View on Github external
router.get("/", function(req, res, next) {
  axios_client
    .get(
      "http://" + env.get("CATALOG_ENDPOINT").asString() + "/api/v1/products"
    )
    .then(function(value) {
      res.render("products", {
        title: "AnyCompany Shop - All Products",
        product: value.data,
        user: req.user
      });
    })
    .catch(error => {
      //log but ignore error
      //console.log(error.message)
      next(error);
    });
});
github Ethercast / serverless-blockstream / src / util / env.ts View on Github external
export const BLOCKS_TABLE: string = env.get('BLOCKS_TABLE').required().asString();
export const BLOCKSTREAM_STATE_TABLE: string = env.get('BLOCKSTREAM_STATE_TABLE').required().asString();
export const ABI_TABLE: string = env.get('ABI_TABLE').required().asString();

export const NEW_BLOCK_QUEUE_NAME: string = env.get('NEW_BLOCK_QUEUE_NAME').required().asString();
export const LOG_FIREHOSE_QUEUE_NAME: string = env.get('LOG_FIREHOSE_QUEUE_NAME').required().asString();
export const TRANSACTION_FIREHOSE_QUEUE_NAME: string = env.get('TRANSACTION_FIREHOSE_QUEUE_NAME').required().asString();

export const BLOCK_READY_TOPIC_NAME: string = env.get('BLOCK_READY_TOPIC_NAME').required().asString();
export const BLOCK_PROCESSED_TOPIC_NAME: string = env.get('BLOCK_PROCESSED_TOPIC_NAME').required().asString();

export const NUM_BLOCKS_DELAY: number = env.get('NUM_BLOCKS_DELAY').required().asIntPositive();

export const REWIND_BLOCK_LOOKBACK: number = env.get('REWIND_BLOCK_LOOKBACK').required().asIntPositive();

export const ETHERSCAN_API_URL: string = env.get('ETHERSCAN_API_URL').required().asUrlString();
export const ETHERSCAN_API_KEY: string = env.get('ETHERSCAN_API_KEY').required().asString();
github Ethercast / serverless-blockstream / src / util / env.ts View on Github external
export const BLOCKSTREAM_STATE_TABLE: string = env.get('BLOCKSTREAM_STATE_TABLE').required().asString();
export const ABI_TABLE: string = env.get('ABI_TABLE').required().asString();

export const NEW_BLOCK_QUEUE_NAME: string = env.get('NEW_BLOCK_QUEUE_NAME').required().asString();
export const LOG_FIREHOSE_QUEUE_NAME: string = env.get('LOG_FIREHOSE_QUEUE_NAME').required().asString();
export const TRANSACTION_FIREHOSE_QUEUE_NAME: string = env.get('TRANSACTION_FIREHOSE_QUEUE_NAME').required().asString();

export const BLOCK_READY_TOPIC_NAME: string = env.get('BLOCK_READY_TOPIC_NAME').required().asString();
export const BLOCK_PROCESSED_TOPIC_NAME: string = env.get('BLOCK_PROCESSED_TOPIC_NAME').required().asString();

export const NUM_BLOCKS_DELAY: number = env.get('NUM_BLOCKS_DELAY').required().asIntPositive();

export const REWIND_BLOCK_LOOKBACK: number = env.get('REWIND_BLOCK_LOOKBACK').required().asIntPositive();

export const ETHERSCAN_API_URL: string = env.get('ETHERSCAN_API_URL').required().asUrlString();
export const ETHERSCAN_API_KEY: string = env.get('ETHERSCAN_API_KEY').required().asString();

env-var

Verification, sanitization, and type coercion for environment variables in Node.js

MIT
Latest version published 6 months ago

Package Health Score

84 / 100
Full package analysis

Popular env-var functions