config

package
v0.0.0-...-e065fbe Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config is used to set up and manage the Scribe config file

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultName for the config file
	DefaultName = ".scribe.json"

	// DefaultLocation for the config file
	DefaultLocation = ""

	// DefaultType of file for the config file
	DefaultType = "json"

	// DefaultLicense for any file being created
	DefaultLicense = "MIT"

	// DefaultIpfsPath for storing IPFS files on this node
	DefaultIpfsPath = ""

	// DefaultStorageMax is the maximum storage available for the IPFS repo
	DefaultStorageMax = "1GB"

	// DefaultProject to operate on
	DefaultProject = "scribe-test-project"
)

Functions

func CheckConfig

func CheckConfig() error

CheckConfig will check the fields of the in-memory Viper config it will attempt to make any directories that don't exist

func DumpConfig2JSON

func DumpConfig2JSON() (string, error)

DumpConfig2JSON will unmarshall the config from Viper to a JSON string

func GenerateDefault

func GenerateDefault() error

GenerateDefault will generate the default config on disk

func ResetConfig

func ResetConfig(configPath string) error

ResetConfig will remove any existing config and replace it with the default one NOTE: the caller must reload the config into viper

Types

type ScribeConfig

type ScribeConfig struct {
	FileName     string `json:"fileName"`
	FileLocation string `json:"fileLocation"`
	FileType     string `json:"fileType"`
	License      string `json:"license"`
	Private      bool   `json:"private"`
	IpfsPath     string `json:"ipfsPath"`
	StorageMax   string `json:"storageMax"`
	Pinning      bool   `json:"pinning"`
	RemoteCID    string `json:"remoteCID"`
	Project      string `json:"project"`
}

ScribeConfig is a struct to hold the config data

func DumpConfig2Mem

func DumpConfig2Mem() (*ScribeConfig, error)

DumpConfig2Mem will unmarshall the config from Viper to a struct in memory

Jump to

Keyboard shortcuts

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