forked from mirrors/homebox
update CI
This commit is contained in:
parent
8c5f481fb9
commit
08d6c83fd4
4 changed files with 18 additions and 5 deletions
9
.github/workflows/go.yaml
vendored
9
.github/workflows/go.yaml
vendored
|
@ -26,6 +26,15 @@ jobs:
|
||||||
- name: Install Task
|
- name: Install Task
|
||||||
uses: arduino/setup-task@v1
|
uses: arduino/setup-task@v1
|
||||||
|
|
||||||
|
- name: golangci-lint
|
||||||
|
uses: golangci/golangci-lint-action@v3
|
||||||
|
with:
|
||||||
|
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
|
||||||
|
version: latest
|
||||||
|
|
||||||
|
# Optional: working directory, useful for monorepos
|
||||||
|
working-directory: backend
|
||||||
|
|
||||||
- name: Build API
|
- name: Build API
|
||||||
run: task api:build
|
run: task api:build
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,12 @@ func run(cfg *config.Config) error {
|
||||||
// Start Reoccurring Tasks
|
// Start Reoccurring Tasks
|
||||||
|
|
||||||
go app.StartReoccurringTasks(time.Duration(24)*time.Hour, func() {
|
go app.StartReoccurringTasks(time.Duration(24)*time.Hour, func() {
|
||||||
app.repos.AuthTokens.PurgeExpiredTokens(context.Background())
|
_, err := app.repos.AuthTokens.PurgeExpiredTokens(context.Background())
|
||||||
|
if err != nil {
|
||||||
|
app.logger.Error(err, logger.Props{
|
||||||
|
"details": "failed to purge expired tokens",
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
return app.server.Start(routes)
|
return app.server.Start(routes)
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
|
|
||||||
"github.com/ardanlabs/conf/v2"
|
"github.com/ardanlabs/conf/v2"
|
||||||
"github.com/ardanlabs/conf/v2/yaml"
|
"github.com/ardanlabs/conf/v2/yaml"
|
||||||
|
@ -48,7 +47,7 @@ func NewConfig(file string) (*Config, error) {
|
||||||
if _, err := os.Stat(file); errors.Is(err, os.ErrNotExist) {
|
if _, err := os.Stat(file); errors.Is(err, os.ErrNotExist) {
|
||||||
return conf.Parse(prefix, &cfg)
|
return conf.Parse(prefix, &cfg)
|
||||||
} else {
|
} else {
|
||||||
yamlData, err := ioutil.ReadFile(file)
|
yamlData, err := os.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package mailer
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io/ioutil"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
@ -14,7 +14,7 @@ const (
|
||||||
|
|
||||||
func GetTestMailer() (*Mailer, error) {
|
func GetTestMailer() (*Mailer, error) {
|
||||||
// Read JSON File
|
// Read JSON File
|
||||||
bytes, err := ioutil.ReadFile(TestMailerConfig)
|
bytes, err := os.ReadFile(TestMailerConfig)
|
||||||
|
|
||||||
mailer := &Mailer{}
|
mailer := &Mailer{}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue