Skip to content

Commit

Permalink
docs: updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
daithihearn committed Nov 5, 2023
1 parent 5c3fa81 commit 0551add
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ clear-build: #@ Clear build folder
rm -rf build && mkdir build && mkdir build/api && mkdir build/api/pkg && mkdir build/api/pkg/i18n
copy-translations: #@ Copy translations
cp -r pkg/i18n/*.toml build/api/pkg/i18n
build: test docs vet clear-build copy-translations #@ Build the binary
go build -o build/api/main cmd/api/main.go
build: test docs vet clear-build copy-translations #@ Build the api and sync binaries
go build -o build/api/main cmd/api/main.go && go build -o build/sync/main cmd/sync/main.go
.PHONY:build
image: docs vet #@ Build docker image
docker build -t electricity-prices . --load
58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,57 @@
# electricity-prices-go
# Electricity Prices API

An API for information about electricity prices in Spain. Data is scraped from [REData Api](https://www.ree.
es/en/apidatos) and exposed via a [restful API](https://elec-api.daithiapp.com/).

This API supports a [dashboard application](https://elec.daithiapp.com/), an Alexa Skill and Flash briefing.

In addition to the API there is a sync job that can be run separately to sync data from REData.

This repo is a replacement for the [original implementation](https://github.com/daithihearn/electricity-prices) written in Kotlin.

## Stack

- Go
- MongoDB

## API
To run locally you will need to have a MongoDB instance running. Update the `MONGO_URL` environment variable to point to your instance.
You will also require `make` to be installed.

Then to run locally simply run:

```bash
make run
```

To build the executable binaries locally run:

```bash
make build
```
The binaries will be installed in the build folder and can be run directly.

If you want to build the docker image run:

```bash
make image
```

## Sync Job
To run the sync locally run:

```bash
make sync
```

The `make build` command described in the API section will build both binaries.

The `make image` command described in the API section will build a single docker image for both the API and sync job.

To run the docker image for the sync job run like so:

```bash
docker run -d --rm elec-prices-sync ./sync
```

Running without the `./sync` will run the API.

0 comments on commit 0551add

Please sign in to comment.