@commoners/local-services

0.0.43 • Public • Published

@commoners/local-services

Connect to shared services (exposed via commoners share) available on your local network on desktop.

Arguments

  • isValid - A function that returns whether or not a service should be connected to ((ip, env) => boolean)

    • ip - The IP address of the service (localhost if the current machine)
    • env - The service's environment variables
  • port - The port to use for the service gateway (number)

    • Optional if you have a COMMONERS_SHARE_PORT environment variable

Example

import localServicesPlugin from '@commoners/local-services'

export default {
    plugins: [
        localServicesPlugin((ip, env) => {
                if (ip === 'localhost') return true
                return env.SECRET_KEY === '****************'
            }, 3768)
    ]
}

With the above configuration, you would be able to discover shared services on your local machine by running commoners share --port 3768.

Dependents (0)

Package Sidebar

Install

npm i @commoners/local-services

Weekly Downloads

9

Version

0.0.43

License

MIT

Unpacked Size

8.51 kB

Total Files

7

Last publish

Collaborators

  • garrettmflynn