From be78def5aa0d5952f00dd92840763f011d596c28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mickae=CC=88l=20Menu?= Date: Sat, 27 Mar 2021 14:33:44 +0100 Subject: [PATCH] Fix #20 local configuration is optional --- CHANGELOG.md | 7 ++++++- core/zk/config.go | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 099c9db..05b3d78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,12 @@ All notable changes to this project will be documented in this file. - +## Unreleased + +### Changed + +* The local configuration is not required anymore in a notebook's `.zk` directory. + ## 0.3.0 diff --git a/core/zk/config.go b/core/zk/config.go index a91cbd6..17b5277 100644 --- a/core/zk/config.go +++ b/core/zk/config.go @@ -170,6 +170,12 @@ func (c *GroupConfig) Override(overrides ConfigOverrides) { // OpenConfig creates a new Config instance from its TOML representation stored // in the given file. func OpenConfig(path string, parentConfig Config) (Config, error) { + // The local config is optional. + exists, err := paths.Exists(path) + if err == nil && !exists { + return parentConfig, nil + } + content, err := ioutil.ReadFile(path) if err != nil { return parentConfig, errors.Wrapf(err, "failed to open config file at %s", path)