diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..834f5a7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM golang:alpine AS build +COPY . /app +WORKDIR /app +RUN GOOS=linux go generate +RUN GOOS=linux go build -o oko-spaceapi cmd/server.go + +FROM alpine +WORKDIR /app +COPY --from=build /app/oko-spaceapi /app/oko-spaceapi +EXPOSE 8080 +CMD ["/app/oko-spaceapi"] diff --git a/cmd/server.go b/cmd/server.go index 843b59b..2a45a7b 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -11,21 +11,56 @@ func main() { definition := spaceapi.Root{ // TODO: Fill up with stuff ApiCompatibility: []string{"14"}, - Links: []*spaceapi.LinksItems{ - { - Description: "Out main website", - Name: "website", - Url: "https://okoyono.de", - }, - }, - Space: "økoyono", - Url: "https://okoyono.de/", + Space: "økoyono", + Url: "https://okoyono.de/", Contact: &spaceapi.Contact{ - Email: "contact@okoyono.de", + Email: "oko@datenhalter.de", // TODO: Better email + Mastodon: "@f@social.okoyono.de", // TODO: Replace with real handle + Matrix: "#public:matrix.okoyono.de", }, Location: &spaceapi.Location{ Address: "", }, + Logo: "https://okoyono.de/images/ant.svg", + Links: []*spaceapi.LinksItems{ + { + Description: "Main website", + Name: "website", + Url: "https://okoyono.de", + }, + { + Description: "Forgejo SCM", + Name: "forgejo", + Url: "https://git.okoyono.de", + }, + { + Description: "Mastodon", + Name: "mastodon", + Url: "https://social.okoyono.de", + }, + }, + Projects: []string{ + "https://buchdesmonats.okoyono.de/", + "https://comicdesmonats.okoyono.de/", + "https://git.okoyono.de/okoyono/weatherstation", + }, + Sensors: &spaceapi.Sensors{ + TotalMemberCount: []*spaceapi.TotalMemberCountItems{ + { + Description: "We are a small group of people from south Germany, meeting remote on a regular basis.", + Location: "Remote", + Value: 7, + }, + }, + //Temperature: []*spaceapi.TemperatureItems{ + // { + // Location: "@f", + // Name: "weatherstatiøn", + // Description: "Weatherstatiøn located at @f.", + // Value: sensors.TemperatureF(), + // }, + //}, + }, } json, err := definition.MarshalJSON() diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..ababb63 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,8 @@ +version: "3" + +services: + spaceapi: + build: . + restart: always + ports: + - "8080:8080" \ No newline at end of file diff --git a/pkg/sensors/wind.go b/pkg/sensors/wind.go new file mode 100644 index 0000000..632abb8 --- /dev/null +++ b/pkg/sensors/wind.go @@ -0,0 +1,6 @@ +package sensors + +func TemperatureF() float64 { + // TODO: Fetch from influxdb (or remove influxdb finally!) + return 10.0 +}