Socket
Socket
Sign inDemoInstall

@ghii/http-loader

Package Overview
Dependencies
9
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @ghii/http-loader

A Funny http loader for ghii configuration manager


Version published
Weekly downloads
68
decreased by-15%
Maintainers
2
Install size
1.97 MB
Created
Weekly downloads
 

Readme

Source

GHII - HTTP LOADER

Http loader is a ghii loader. It is used to load the configurations of a nodejs application by calling an endpoint which returns a json with the configurations to be injected into the application.

How to install:

npm install @ghii/http-loader

Configuration in yaml:

env: development
app:
  version: "0.0.1"
  name: "ghii-test"

in JSON:

{
  "env": "development",
  "app": {
    "version": "0.0.1",
    "name": "ghii-test"
  }
}

Usage example:

import ghii from "@ghii/ghii";
import httpLoader from "@ghii/http-loader";

const options = ghii((T) =>
  T.Object({
    env: T.Union([T.Literal("development"), T.Literal("production")], {
      default: "development",
    }),
    app: T.Object(
      {
        name: T.String({ default: "test" }),
        version: T.String(),
      },
      { additionalProperties: false, default: {} }
    ),
  })
).loader(
  //example url http://localhost:4000/.wellknown.json
  httpLoader(process.env.WELLKNOWN_URL!, {
    throwOnError:  process.env.NODE_ENV !== 'development', //silent mode
    logger: (err, msg) => {
      if (err) {
        customLogger.error(err, msg);
      } else {
        customLogger.debug(msg);
      }
    },
  })
);

export default options;

Keywords

FAQs

Last updated on 25 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc