Categorygithub.com/YaleSpinup/test-api
modulepackage
0.4.5
Repository: https://github.com/yalespinup/test-api.git
Documentation: pkg.go.dev

# README

test-api

license go-mod go-doc

A super simple, very basic, hacked together test api (for testing).

Endpoints

GET /metrics GET /v1/test/args
GET /v1/test/env
GET /v1/test/list
GET /v1/test/metadata/task
GET /v1/test/metadata/stats
GET /v1/test/metadata/task/stats
GET /v1/test/mirror
GET /v1/test/panic
GET /v1/test/ping
GET /v1/test/readme
GET /v1/test/routes
GET /v1/test/status{?code=XXX}
POST /v1/test/upload
GET /v1/test/version

Environment variables used for configuration

The following environment variables can be used to configure the test-api at runtime.

VariableDefault ValueDescription
LISTEN_ADDR:8080Set the listen address as IP:PORT, :PORT will listen on all interfaces
VOLUME_ENABLEfalseSet to true to enable volume access
VOLUME_PATHuploadsSet the filesystem path for volume access

Get Command Line Arguments

Returns the command line arguments as JSON.

For example, starting with ./test-api foo bar baz --help will return:

{
  "Args": [
    "foo",
    "bar",
    "baz",
    "--help"
  ]
}

Get Environment Variables

Returns the list of environment variables as JSON.

[
  "PWD=/app",
  "SHELL=/bin/bash",
  "USER=nobody",
  "AWS_DEFAULT_REGION=us-east-1"
]

Get Files

Returns a list of files in the VOLUME_PATH

{
    "Files": [
        {
            "Name": "083821609-20200612_133928832.mp4",
            "Size": "2.7 MB",
            "ModTime": "Thu Jul 23 09:50:05 2020"
        },
        {
            "Name": "491786708-colors-1838392_1920.jpg",
            "Size": "601.0 kB",
            "ModTime": "Thu Jul 23 09:33:12 2020"
        }
    ]
}

Display Readme

GET this README as html

Upload Files

POST a file as multipart form data. The form key needs to be file.

Author

E Camden Fisher [email protected]

License

GNU Affero General Public License v3.0 (GNU AGPLv3) Copyright (c) 2020 Yale University

# Variables

Buildstamp is the timestamp the binary was built, it should be set at buildtime with ldflags.
No description provided by the author
Githash is the git sha of the built binary, it should be set at buildtime with ldflags.
Version is the main version number.