npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@mimik/public-helper

v3.0.3

Published

Public IP helper for mimik microservices

Readme

public-helper

Example

import publicHlelper from '@mimik/public-helper';
or
import { PROPERTIES, getLocation, getPublic, setSettings } from '@mimik/public-helper';

The following environment variables are required for custom locations:

| Env variable name | Description | Default | Comments |
| ----------------- | ----------- | ------- | -------- |
| SERVER_LOCATION_LON | longitude of the IP address
| SERVER_LOCATION_LAT | latitude of the IP address
| SERVER_PUBLIC_IPV4 | public IP address

module.exports ⏏

To note

The following environment variables are required for custom locations: SERVER_PUBLIC_IPV4 with 52.84.158.59, SERVER_LOCATION_LON with -122.676, SERVER_LOCATION_LAT with 45.5235, LOCATION_PROVIDER with "environment".

Kind: Exported member

module.exports.PROPERTIES

Property associated with the location.

The following environment variables are set:

| Env variable name | Description | Default | Comments | | ----------------- | ----------- | ------- | -------- | | query[URL_ENV] | query to fill the different local properties from AWS| | SERVER_LOCAL_IPV4, INSTANCE_ID, LOCAL_HOSTNAME | publicQuery[URL_ENV] | publicQuery to fill the public property from AWS | | SERVER_PUBLIC_IPV4

The following environment variables are used:

| Env variable name | Description | Default | Comments | | ----------------- | ----------- | ------- | -------- | | AWS_LOCAL_PROPERTIES | IP address to access instance properties on AWS | 169.254.169.254

Kind: static constant of module.exports

module.exports~getLocation(}, ip, correlationId, options) ⇒ Promise

The location object has the follwoing structure:

 {
   "type": "Point",
   "coordinates": [ lon, lat],
   .....
 }

The result object has the following structure:

 {
   "status": (describing where the data come from),
   "ip": (the public IP address of the server),
   "location": (the location object)
 }

When ip is not present, SERVER_LOCATION_LON, SERVER_LOCATION_LAT, SERVER_PUBLIC_IPV4 environment variables will be updated.

Kind: inner method of module.exports
Returns: Promise - .
Category: async
Fulfil: object The location object encapsulated in the result.

| Param | Type | Description | | --- | --- | --- | | } | object | locationProvider - location provider information to use for getting the location { url, key } (key is optional). | | ip | IP.<string> | Optional IP address to locate. | | correlationId | string | Correlation Id to add the the request. | | options | object | Options associated with the call. Use to pass metrics to rpRetry. |

module.exports~getPublic(locationProvider, cloudProvider, correlationId, options) ⇒ Promise

The location data has the following structure:

 {
   "status": (describing where the data come from),
   "ip": (the public IP address of the server),
   "localIp": (`in case of AWS` local adddress),
   "instanceId": (`in case of AWS` id of the instance running the service),
   "location": (the location object)
 }

When provided, the locationProvider information has the following stucture:

 {
   "url": (URL of the provider),
   "key": (security key to associated with the request)
 }

on top of SERVER_PUBLIC_IPV4, SERVER_LOCATION_LON and SERVER_LOCATION_LAT the following environment variables will used:

| Env variable name | Description | Default | Comments | | ----------------- | ----------- | ------- | -------- | | SERVER_LOCAL_IPV4 | AWS local IP address | INSTANCE_ID | id of the instance | SERVER_ID | id of the server

and in order to set these properties process.env.AWS_LOCAL_PROPERTIES is used and is default 169.254.169.254 is used.

Kind: inner method of module.exports
Returns: Promise - .
Category: async
Fulfil: object The location data.

| Param | Type | Description | | --- | --- | --- | | locationProvider | URL.<string> | The location provider or noPublic when no locationProvider is used or environment when the environment variables have the information. | | cloudProvider | string | Cloud Provider used to run the service (currently limited to AWS). | | correlationId | string | Correlation Id to add the the request. | | options | object | Options associated with the call. Use to pass metrics to rpRetry. |

module.exports~setSettings(settings, newConfig) ⇒ object

Set config.serverSettings with location data.

Kind: inner method of module.exports
Returns: object - The updated config.serverSettings.
Category: sync

| Param | Type | Description | | --- | --- | --- | | settings | object | The config.serverSettings to update. | | newConfig | object | The location configuration to use to update the config.serverSettings. |