qvain-api

module
v0.10.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2020 License: GPL-3.0

README

GoDoc

Build Status

Go Report Card

Qvain API

Introduction

Qvain is the metadata editor for the FairData project by the Finnish Ministry of Education and Culture. It has been developed by the National Library of Finland.

This repository contains the server backend, written in the Go programming language.

If you are looking for technical information, the doc/ directory in the source contains a list of Qvain related links as well as a brief introduction to setting up Go for those who would like to contribute.

Installation

Install Go

The Go project releases a new version every half year, and only supports the last two releases. The best version for compiling this application is the latest available from the official Go website.

Before Go 1.11, the language did not have built-in dependency management; go get always downloaded the latest version available from dependency repositories. More recent versions of Go have an official dependency tool called Go Modules. It's strongly suggested to use a recent version of Go that has support for modules so dependency issues are avoided and compilation would give you the exact same end result.

Get code

If you run a recent version of Go, just clone the repository wherever you want. The build process will automatically install the correct dependency versions from the lock file; you don't need to do anything.

$ git clone https://github.com/CSCfi/qvain-api
$ cd qvain-api

If you can't update to a recent version of Go, you'll have to make sure the source is checked out in your GOPATH, and check out the dependencies manually with go get:

$ go env GOPATH
/home/jack/GoPath
$ cd $GOPATH
$ mkdir -p src/github.com/CSCfi
$ cd src/github.com/CSCfi
$ git clone https://github.com/CSCfi/qvain-api
$ cd qvain-api
$ go get -v ./cmd/...

Note: The triple dot syntax ... in Go commands means "and anything below that". So that last command should get all dependencies for anything in the cmd/ directory.

Build

You can build this application with the included Makefile or with standard Go commands. The benefit of the Makefile is that it will insert version information during the compilation; prefer this for "official" releases running on real servers.

$ make all

Compiled binaries will end up in the bin/ directory.

If you don't have make installed, you can build the application with standard Go commands:

$ GOBIN=$PWD/bin go install -v ./cmd/...

... This will build the commands in the cmd/ directory and install them into the bin/ directory. The GOBIN environment variable points to the location Go will store compiled binaries.

It's preferred to store the binaries into bin/ so they don't get accidentally checked into the source repository.

Rebuild

To re-compile the code after modification, just run make all or go install like above.

If you only want to (re)build one program – let's say the backend – then just use go build directly:

$ go build -o bin/qvain-backend ./cmd/qvain-backend

This will build the source for the backend from the directory ./cmd/qvain-backend and store/overwrite the executable in bin/.

Alternatively, you can change into the directory of the command you want to build and just run go build:

$ cd cmd/qvain-backend
$ go build -v

Note that in this case you will have to run go clean because the binary will sit in the source directory and we don't want to check it into the code repository.

Clean

Run make clean or just delete the contents of bin/:

$ rm bin/*

If you have built binaries inside the source tree instead of outputting them to bin/, run go clean:

$ go clean ./...

This will find all build artifacts in the source code and delete them. It will not touch bin/ because that's made by us.

Run

Go compiles to binary executable files, so just run the command:

$ bin/metax-cli
metax-query (version 178e2ee)
usage: bin/metax-cli <sub-command> [flags]

  datasets   query dataset API endpoint
  fetch      fetch from dataset API endpoint
  publish    publish dataset to API endpoint
  version    query version

License

Copyright (c) 2016-2018 The National Library of Finland

Copyright (c) 2019 The Ministry of Education and Culture of Finland

Licensed under the GNU GPL 3.0.

This repository contains third party software. Individual package dependencies remain the property of their respective owners and under their own respective licenses.

Directories

Path Synopsis
cmd
es-cli
Command es-cli is a command-line interface to sync reference metadata stored in ElasticSearch.
Command es-cli is a command-line interface to sync reference metadata stored in ElasticSearch.
metax-cli
Command metax-cli is a command-line client to the Metax API.
Command metax-cli is a command-line client to the Metax API.
qvain-backend
Command qvain-backend is the backend server for the Qvain API.
Command qvain-backend is the backend server for the Qvain API.
qvain-cli
Command qvain-cli is a command-line interface to the Qvain backend.
Command qvain-cli is a command-line interface to the Qvain backend.
internal
bench
Dummy file to stop go build from complaining about packages with only test files.
Dummy file to stop go build from complaining about packages with only test files.
caller
Package caller contains convenience functions to get function caller information.
Package caller contains convenience functions to get function caller information.
es
Package es contains a minimal API client to query Elastic Search and export complete indexes.
Package es contains a minimal API client to query Elastic Search and export complete indexes.
oidc
Package oidcclient implements a basic oidc client to authenticate users at an OpenID Connect IdP using the Code flow.
Package oidcclient implements a basic oidc client to authenticate users at an OpenID Connect IdP using the Code flow.
psql
Package psql is the Postgresql storage layer of Qvain.
Package psql is the Postgresql storage layer of Qvain.
randomkey
Package randomkey generates cryptographically secure keys of lengths 16, 32 or 64.
Package randomkey generates cryptographically secure keys of lengths 16, 32 or 64.
redis
Package redis wraps the redigo redis package.
Package redis wraps the redigo redis package.
sessions
Package session implements a simple session manager for token authentication.
Package session implements a simple session manager for token authentication.
version
Package version contains the version for the whole of Qvain and associated commands.
Package version contains the version for the whole of Qvain and associated commands.
pkg
concat
Package concat is a utility package that concatenates multiple files into one with optional date dependency checking.
Package concat is a utility package that concatenates multiple files into one with optional date dependency checking.
env
Package env provides some convenience functions to get configuration values from the environment.
Package env provides some convenience functions to get configuration values from the environment.
metax
Package metax provides a client for the CSC MetaX API.
Package metax provides a client for the CSC MetaX API.
models
Package models contains the base "domain logic" data types used by Qvain.
Package models contains the base "domain logic" data types used by Qvain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL