sensorpush-proxy

command module
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2023 License: ISC Imports: 2 Imported by: 0

README

THIS README IS A WORK-IN-PROGRESS!

sensorpush-proxy

A rate-limiting, authentication-hiding proxy for SensorPush data.

Usage

More than likely, you’ll want to use the already-built Docker image for this, so that you can just throw your credentials and sensor config at it and let it run behind something like Traefik or nginx. Regardless of whether you use Docker or the raw binary, sensorpush-proxy includes both the proxy itself and also a query sub-command to help you discover the sensor IDs available to you.

Get SensorPush credentials

If you have any SensorPush devices, you ought to already have an account with SensorPush. In order to activate API access, you need to sign into their Gateway Cloud Dashboard at least once and agree to the terms of service. Once you've done that, the username and password you use for that dashboard are the same ones you need for this proxy. Unfortunately, SensorPush does not allow you to create limited-use (and revocable) tokens to use in place of your password for API access. This proxy only uses the password you provide in order to retrieve the sensor data you request. Use secure best practices to ensure that the configuration you pass to this proxy is kept secret/encrypted until the last possible moment.

Get sensorpush-proxy
Discover sensor IDs

Use the query subcommand

Docker image
Binary (from release or source)

Uses the SensorPush API to fetch data.


(from puppycam-sensor...)

In order to get the config into the deployed container without putting it in plaintext in the source, we end-run through the Drone "encrypted secret" mechanism, and decode/expand it during the build.

  • config.yaml -> base64 encoded (one line) -> drone encrypt
drone encrypt JaredReisinger/puppycam-sensor $(cat config.yaml | base64 -w0)

This (as of this moment) results in:

0z6PxJVqtfoSWiUb+831gUC1jViO5zctZkwyqTJ7AfUY1c8Vmc1v3oiCgAWqAr/qH6ZXaC/H6CiOI9fjkVlOM6XafVeUi19kkq6dESzZxvdv1+y6MVA8jy9+7olrcQeagu4PQ0JjtbYdgIUTuPpBT5LR2lQEPKZqJHGVYeAzLsSOwIastH/M8oLihGbDYTu/cBsCxAEgAMTq11jz4vn9/eThEZQ5PbkmglP1ww==

Then, in the drone file, we include the above string as a secret, put the value into an environment variable (called CONFIG_YAML), and re-hydrate as a local file:

printf "$${CONFIG_YAML}" | base64 -d > config.yaml

Note that the double-$ is needed to prevent Drone from attempting to expand the value itself.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
config
Package config provides common config and CLI support for the sensorpush proxy and tools, so that each tool does not need to duplicate the common settings and config parsing logic.
Package config provides common config and CLI support for the sensorpush proxy and tools, so that each tool does not need to duplicate the common settings and config parsing logic.
jsonapi
Package jsonapi provides a very basic JSON REST-like API client.
Package jsonapi provides a very basic JSON REST-like API client.
sensorpush
Package sensorpush provides a wrapper for accessing the SensorPush API.
Package sensorpush provides a wrapper for accessing the SensorPush API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL