You can stream and read files to a sentry DSN glitchtip or sentry itself I was fed up with how brittle sentry-cli was so I made this. 

I might get around to making a whole CI/CD process for this which will upload the executables properly at some point and make this public.
# Go Glitch

Go Glitch is a command-line utility that reads log messages from a file or stdin and sends them to Glitchtip, Sentry, or any compatible error tracking system.

## Installation

To install the binary locally, you can use the provided installation script. Run the following command in your terminal:

```sh
curl -sSL https://git.nixc.us/Nixius/go-glitch/raw/branch/master/install.sh | bash
```

This will download and install the Go Glitch binary to your local machine.

## Usage

You can use Go Glitch by specifying a log file as an argument or by piping input to it.

### Using a Log File

```sh
go-glitch /path/to/logfile
```

### Using Piped Input

```sh
cat /path/to/logfile | go-glitch
```

### Server Mode

You can also run Go Glitch in server mode, which starts a webhook server that accepts log messages via HTTP requests:

```sh
go-glitch server
```

The server listens on port 5050 by default. You can send log messages to the webhook endpoint:

```sh
curl -X POST -H "Content-Type: application/json" \
  -d '{"log_level": "error", "message": "Error message", "service": "my-service"}' \
  http://localhost:5050/webhook
```

## Configuration

Go Glitch supports multiple environment variables for the DSN. You can use any of the following:

- `GLITCHTIP_DSN`: For GlitchTip instances
- `SENTRY_DSN`: For Sentry instances
- `BUGSINK_DSN`: For Bugsink instances

If multiple environment variables are set, they are checked in the order listed above, and the first one found is used.

### Setting the DSN

#### Shell Environment

Add one of the following lines to your `.zshrc` or `.bashrc` file:

```sh
export GLITCHTIP_DSN="your-dsn"
# OR
export SENTRY_DSN="your-dsn"
# OR
export BUGSINK_DSN="your-dsn"
```

After adding the line, reload your shell configuration:

```sh
source ~/.zshrc # for zsh users
source ~/.bashrc # for bash users
```

#### Dockerfile

If you are using a Docker container, add the environment variable in your `Dockerfile`:

```Dockerfile
ENV GLITCHTIP_DSN=your-dsn
# OR
ENV SENTRY_DSN=your-dsn
# OR
ENV BUGSINK_DSN=your-dsn
```

#### docker-compose.yml

If you are using Docker Compose, add the environment variable in your `docker-compose.yml` file:

```yaml
version: '3.8'

services:
  go-glitch:
    image: your-docker-image
    environment:
      - GLITCHTIP_DSN=your-dsn
      # OR
      # - SENTRY_DSN=your-dsn
      # OR
      # - BUGSINK_DSN=your-dsn
```

## Development

### Testing Protocol

Go Glitch includes a comprehensive test suite in `build-run-test.sh` that ensures all functionality works correctly:

1. **Build and Verification**: The script builds the application for all supported platforms and verifies that the binaries are created.

2. **Environment Variable Tests**: Each supported DSN environment variable is tested with both plain text and JSON input:
   - `GLITCHTIP_DSN`
   - `SENTRY_DSN`
   - `BUGSINK_DSN`

3. **Priority Tests**: The script tests that when multiple environment variables are set, the correct order of precedence is followed.

4. **Webhook Tests**: The server mode is tested with both single and batch webhook requests.

To run the tests, simply execute:

```sh
./build-run-test.sh
```

The script provides clear, color-coded output with pass/fail indicators for each test.

### Contributing

Before submitting changes, please ensure that:

1. You have run `./build-run-test.sh` to verify that all tests pass
2. Your changes maintain compatibility with all supported DSN environment variables
3. Any new features include appropriate tests in the test suite
