Skip to content

Commit

Permalink
added support for configuring ep3apid from YAML file
Browse files Browse the repository at this point in the history
  • Loading branch information
R. S. Doiel committed Jun 10, 2024
1 parent e3c0993 commit e0ce6fa
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 16 deletions.
2 changes: 1 addition & 1 deletion about.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<section>
<h1 id="about-this-software">About this software</h1>
<h2 id="eprinttools-1.3.7">eprinttools 1.3.7</h2>
<h2 id="eprinttools-1.3.8">eprinttools 1.3.8</h2>
<h3 id="authors">Authors</h3>
<ul>
<li>R. S. Doiel</li>
Expand Down
4 changes: 2 additions & 2 deletions about.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ authors:
orcid: "https://orcid.org/0000-0003-0900-6903"

repository-code: "https://github.com/caltechlibrary/eprinttools"
version: 1.3.7
version: 1.3.8
license-url: "https://caltechlibrary.github.io/eprinttools/license.html"
keywords: [ "metadata", "repository", "EPrints", "CrossRef", "DataCite", "software" ]
date-released: 2023-06-06
Expand All @@ -20,7 +20,7 @@ date-released: 2023-06-06
About this software
===================

## eprinttools 1.3.7
## eprinttools 1.3.8

### Authors

Expand Down
2 changes: 1 addition & 1 deletion cmd/ep3apid/ep3apid.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ The metadata import functionality is enabled per repository. It only supports im
## settings.json (configuration)
The JSON settings.json file should look something like "REPO_ID" would
The JSON (or YAML) settings.json file should look something like "REPO_ID" would
be the name used in the __{app_name}__ to access a specific repsitory. The
"dsn" value should be replaced with an appropriate data source name to
access the MySQL database for the repository you're supporting. You can have many repositories configured in a single __{app_name}__ instance.
Expand Down
6 changes: 3 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"description": "Command line tools, Golang package and Python module for working with the EPrints 3.x REST API",
"releaseNotes": "Updated Go version to 1.22 and other Go package updates",
"releaseNotes": "Updated Go version to 1.22, added support for YAML config to ep3apid",
"name": "eprinttools",
"codeRepository": "https://github.com/caltechlibrary/eprinttools",
"issueTracker": "https://github.com/caltechlibrary/eprinttools/issues",
"license": "https://caltechlibrary.github.io/eprinttools/license.html",
"version": "1.3.7",
"version": "1.3.8",
"datePublished": "2023-06-06",
"dateRelease": "2023-09-15",
"dateModified": "2024-02-26",
"dateModified": "2024-06-10",
"author": [
{
"@type": "Person",
Expand Down
14 changes: 12 additions & 2 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import (
"io/ioutil"
"net/http"
"os"
"strings"

// 3rd Party Package
"gopkg.in/yaml.v3"
)

// Config holds a configuration file structure used by EPrints Extended API
Expand Down Expand Up @@ -153,8 +157,14 @@ func LoadConfig(fname string) (*Config, error) {
return nil, err
} else {
// Since we should be OK, unmarshal in into active config
if err = jsonDecode(src, &config); err != nil {
return nil, fmt.Errorf("Unmarshaling %q failed, %s", fname, err)
if strings.HasSuffix(fname, ".yaml") {
if err = yaml.Unmarshal(src, &config); err != nil {
return nil, fmt.Errorf("Unmarshaling %q failed, %s", fname, err)
}
} else {
if err = jsonDecode(src, &config); err != nil {
return nil, fmt.Errorf("Unmarshaling %q failed, %s", fname, err)
}
}
if config.Hostname == "" {
config.Hostname = "localhost:8484"
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
github.com/caltechlibrary/simplified v0.0.22
github.com/go-sql-driver/mysql v1.7.1
golang.org/x/crypto v0.20.0
gopkg.in/yaml.v3 v3.0.1
)

require (
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
modernc.org/cc/v3 v3.36.0/go.mod h1:NFUHyPn4ekoC/JHeZFfZurN6ixxawE1BnVonP/oahEI=
modernc.org/ccgo/v3 v3.0.0-20220428102840-41399a37e894/go.mod h1:eI31LL8EwEBKPpNpA4bU1/i+sKOwOrQy8D87zWUcRZc=
Expand Down
2 changes: 1 addition & 1 deletion installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Set the package name and version to install
#
PACKAGE="eprinttools"
VERSION="1.3.7"
VERSION="1.3.8"
GIT_GROUP="caltechlibrary"
RELEASE="https://github.com/$GIT_GROUP/$PACKAGE/releases/tag/v$VERSION"

Expand Down
Binary file added pagefind/fragment/unknown_f94fe17.pf_fragment
Binary file not shown.
Binary file added pagefind/index/unknown_f1da42f.pf_index
Binary file not shown.
4 changes: 2 additions & 2 deletions pagefind/pagefind-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pagefind/pagefind.js

Large diffs are not rendered by default.

Binary file added pagefind/pagefind.unknown_3089af53c37bab2.pf_meta
Binary file not shown.
Binary file modified pagefind/wasm.unknown.pagefind
Binary file not shown.
6 changes: 3 additions & 3 deletions version.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (

const (
// Version number of release
Version = "1.3.7"
Version = "1.3.8"

// ReleaseDate, the date version.go was generated
ReleaseDate = "2024-02-26"
ReleaseDate = "2024-06-10"

// ReleaseHash, the Git hash when version.go was generated
ReleaseHash = "17d7357"
ReleaseHash = "e3c0993"

LicenseText = `
Copyright (c) 2022, Caltech All rights not granted herein are expressly
Expand Down

0 comments on commit e0ce6fa

Please sign in to comment.