Merge pull request #8 from KristianJBorgwarth/feat/rm-config
ref(config): remove redundant config
This commit is contained in:
commit
72ac54213e
2 changed files with 1 additions and 54 deletions
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
|
|
@ -15,14 +15,7 @@ jobs:
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version-file: go.mod
|
go-version-file: go.mod
|
||||||
|
cache: true
|
||||||
- name: Cache Go modules
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/go/pkg/mod
|
|
||||||
key: ${{ runner.os }}-go-${{ hashFiles('go.sum') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.os }}-go-
|
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: go test ./test/test_unit/...
|
run: go test ./test/test_unit/...
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
// Package config provides configuration management for the application, allowing for easy loading and parsing of configuration files, environment variables, and command-line arguments. It supports various formats such as JSON, YAML, and TOML, and provides a unified interface for accessing configuration values throughout the application.
|
|
||||||
package config
|
|
||||||
|
|
||||||
type ScratchConfig struct {
|
|
||||||
Dir string
|
|
||||||
TemplateName string
|
|
||||||
}
|
|
||||||
|
|
||||||
type DailyConfig struct {
|
|
||||||
Dir string
|
|
||||||
TemplateName string
|
|
||||||
FilenameFormat string
|
|
||||||
}
|
|
||||||
|
|
||||||
type Config struct {
|
|
||||||
VaultPath string
|
|
||||||
TemplateDir string
|
|
||||||
ScratchNote ScratchConfig
|
|
||||||
DailyNote DailyConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Config) SetDefaults() {
|
|
||||||
if c.TemplateDir == "" {
|
|
||||||
c.TemplateDir = "templates"
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.ScratchNote.Dir == "" {
|
|
||||||
c.ScratchNote.Dir = "scratch"
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.ScratchNote.TemplateName == "" {
|
|
||||||
c.ScratchNote.TemplateName = "scratch.md"
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.DailyNote.Dir == "daily" {
|
|
||||||
c.DailyNote.Dir = "daily"
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.DailyNote.TemplateName == "" {
|
|
||||||
c.DailyNote.TemplateName = "daily.md"
|
|
||||||
}
|
|
||||||
|
|
||||||
if c.DailyNote.FilenameFormat == "" {
|
|
||||||
c.DailyNote.FilenameFormat = "2006-01-02.md"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Add table
Reference in a new issue