-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from wisdom-oss/dev
Merge Updated Dataschema into Main
- Loading branch information
Showing
38 changed files
with
1,058 additions
and
920 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Mirror Repository | ||
on: [push] | ||
|
||
jobs: | ||
mirror-repo: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: wisdom-oss/mirroring-action@main | ||
with: | ||
user: ${{ secrets.MIRROR_USER }} | ||
pat: ${{ secrets.MIRROR_PASSWORD }} | ||
repository: ${{ github.event.repository.name }} | ||
host: ${{ secrets.MIRROR_HOST }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,5 @@ | |
# allow the following folders | ||
!globals/ | ||
!routes/ | ||
!types/ | ||
!types/ | ||
!config/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
FROM golang:alpine AS build-service | ||
FROM docker.io/golang:alpine AS build-service | ||
COPY . /tmp/src | ||
WORKDIR /tmp/src | ||
RUN mkdir -p /tmp/build | ||
RUN go mod download | ||
RUN go build -o /tmp/build/app | ||
RUN go build -tags docker -o /tmp/build/app | ||
|
||
FROM alpine:latest | ||
FROM docker.io/alpine:latest | ||
COPY --from=build-service /tmp/build/app /service | ||
COPY resources/* / | ||
ENTRYPOINT ["/service"] | ||
LABEL org.opencontainers.image.source=https://github.com/wisdom-oss/service-water-rights | ||
EXPOSE 8000 | ||
ARG GH_REPO=unset | ||
ARG GH_VERSION=unset | ||
LABEL org.opencontainers.image.source=https://github.com/$GH_REPO | ||
LABEL org.opencontainers.image.version=$GH_VERSION | ||
EXPOSE 8000 | ||
HEALTHCHECK --interval=30s --timeout=15s CMD /service -healthcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
//go:build docker | ||
|
||
package config | ||
|
||
import ( | ||
"net/http" | ||
"time" | ||
|
||
chiMiddleware "github.com/go-chi/chi/v5/middleware" | ||
"github.com/go-chi/httplog" | ||
errorMiddleware "github.com/wisdom-oss/microservice-middlewares/v5/error" | ||
securityMiddleware "github.com/wisdom-oss/microservice-middlewares/v5/security" | ||
|
||
"github.com/wisdom-oss/service-water-rights/globals" | ||
) | ||
|
||
// This file contains default paths that are used inside the service to load | ||
// resource files. | ||
// The go toolchain automatically uses this file if the build tag "docker" has | ||
// been set. | ||
// This should be the case in docker images and containers only. | ||
// To achieve the behavior for local development and testing, please remove the | ||
// "docker" build tag | ||
|
||
// Middlewares contains the middlewares used per default in this service. | ||
// To disable single middlewares, please remove the line in which this array | ||
// is used and add the middlewares that shall be used manually to the router | ||
var Middlewares = []func(next http.Handler) http.Handler{ | ||
httpLogger(), | ||
chiMiddleware.RequestID, | ||
chiMiddleware.RealIP, | ||
errorMiddleware.Handler, | ||
securityMiddleware.ValidateServiceJWT, | ||
} | ||
|
||
// EnvironmentFilePath contains the default file path under which the | ||
// environment configuration file is stored | ||
const EnvironmentFilePath = "./environment.json" | ||
|
||
// QueryFilePath contains the default file path under which the | ||
// sql queries are stored | ||
const QueryFilePath = "./queries.sql" | ||
|
||
// ListenAddress sets the host on which the microservice listens to incoming | ||
// requests | ||
const ListenAddress = "" | ||
|
||
func httpLogger() func(next http.Handler) http.Handler { | ||
l := httplog.NewLogger(globals.ServiceName) | ||
httplog.Configure(httplog.Options{ | ||
JSON: true, | ||
Concise: true, | ||
TimeFieldFormat: time.RFC3339, | ||
}) | ||
return httplog.Handler(l) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
//go:build !docker | ||
|
||
package config | ||
|
||
import ( | ||
"net/http" | ||
"time" | ||
|
||
chiMiddleware "github.com/go-chi/chi/v5/middleware" | ||
"github.com/go-chi/httplog" | ||
errorMiddleware "github.com/wisdom-oss/microservice-middlewares/v5/error" | ||
|
||
"github.com/wisdom-oss/service-water-rights/globals" | ||
) | ||
|
||
// This file contains default paths that are used inside the service to load | ||
// resource files. | ||
// The go toolchain automatically uses this file if no build tags have been | ||
// set. | ||
// This should be the case in local development and testing. | ||
// To achieve the behavior in docker containers, supply the build tag "docker" | ||
// and the Docker defaults are used | ||
|
||
// Middlewares contains the middlewares used per default in this service. | ||
// To disable single middlewares, please remove the line in which this array | ||
// is used and add the middlewares that shall be used manually to the router | ||
var Middlewares = []func(next http.Handler) http.Handler{ | ||
httpLogger(), | ||
chiMiddleware.RequestID, | ||
chiMiddleware.RealIP, | ||
errorMiddleware.Handler, | ||
} | ||
|
||
// EnvironmentFilePath contains the default file path under which the | ||
// environment configuration file is stored | ||
const EnvironmentFilePath = "./resources/environment.json" | ||
|
||
// QueryFilePath contains the default file path under which the | ||
// sql queries are stored | ||
const QueryFilePath = "./resources/queries.sql" | ||
|
||
// ListenAddress sets the host on which the microservice listens to incoming | ||
// requests | ||
const ListenAddress = "127.0.0.1" | ||
|
||
func httpLogger() func(next http.Handler) http.Handler { | ||
l := httplog.NewLogger(globals.ServiceName) | ||
httplog.Configure(httplog.Options{ | ||
JSON: false, | ||
Concise: true, | ||
TimeFieldFormat: time.RFC3339, | ||
}) | ||
return httplog.Handler(l) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
package globals | ||
|
||
import "database/sql" | ||
import "github.com/jackc/pgx/v5/pgxpool" | ||
|
||
// This file contains all globally shared connections (e.g., Databases) | ||
|
||
// Db contains the globally available connection to the database | ||
var Db *sql.DB | ||
var Db *pgxpool.Pool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,42 @@ | ||
module microservice | ||
module github.com/wisdom-oss/service-water-rights | ||
|
||
go 1.20 | ||
go 1.22 | ||
|
||
require ( | ||
github.com/blockloop/scan/v2 v2.5.0 | ||
github.com/go-chi/chi/v5 v5.0.8 | ||
github.com/go-chi/httplog v0.3.0 | ||
github.com/georgysavva/scany/v2 v2.1.3 | ||
github.com/go-chi/chi/v5 v5.0.12 | ||
github.com/go-chi/httplog v0.3.2 | ||
github.com/jackc/pgx/v5 v5.6.0 | ||
github.com/joho/godotenv v1.5.1 | ||
github.com/lib/pq v1.10.9 | ||
github.com/paulmach/go.geojson v1.5.0 | ||
github.com/pkg/errors v0.9.1 | ||
github.com/qustavo/dotsql v1.1.0 | ||
github.com/rs/zerolog v1.29.1 | ||
github.com/sanyokbig/pqinterval v1.1.2 | ||
github.com/qustavo/dotsql v1.2.0 | ||
github.com/rs/zerolog v1.33.0 | ||
github.com/twpayne/go-geom v1.5.4 | ||
github.com/wisdom-oss/commonTypes v1.0.0 | ||
github.com/wisdom-oss/microservice-middlewares/v3 v3.0.0 | ||
github.com/wisdom-oss/commonTypes/v2 v2.0.1 | ||
github.com/wisdom-oss/microservice-middlewares/v5 v5.1.2 | ||
golang.org/x/net v0.25.0 | ||
|
||
) | ||
|
||
require ( | ||
github.com/mattn/go-colorable v0.1.12 // indirect | ||
github.com/mattn/go-isatty v0.0.14 // indirect | ||
github.com/wisdom-oss/microservice-utils v1.0.0 // indirect | ||
golang.org/x/sys v0.5.0 // indirect | ||
golang.org/x/text v0.12.0 // indirect | ||
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect | ||
github.com/goccy/go-json v0.10.3 // indirect | ||
github.com/jackc/pgpassfile v1.0.0 // indirect | ||
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect | ||
github.com/jackc/puddle/v2 v2.2.1 // indirect | ||
github.com/lestrrat-go/blackmagic v1.0.2 // indirect | ||
github.com/lestrrat-go/httpcc v1.0.1 // indirect | ||
github.com/lestrrat-go/httprc v1.0.5 // indirect | ||
github.com/lestrrat-go/iter v1.0.2 // indirect | ||
github.com/lestrrat-go/jwx/v2 v2.0.21 // indirect | ||
github.com/lestrrat-go/option v1.0.1 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.20 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/segmentio/asm v1.2.0 // indirect | ||
golang.org/x/crypto v0.23.0 // indirect | ||
golang.org/x/sync v0.7.0 // indirect | ||
golang.org/x/sys v0.20.0 // indirect | ||
golang.org/x/text v0.15.0 // indirect | ||
) |
Oops, something went wrong.