config

package
v0.0.0-...-72f9927 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2022 License: MIT Imports: 17 Imported by: 0

README

Config Schema

If you wish to create mtl/mtl-config.yml manually, follow the config schema.

The mtl directory which contains this config file should be in the same directory as the main application.

Example config:

# Example config
cloudVision:
  credentialsPath: C:\Users\me\credentials.json # Absolute path to service account key (json) for Cloud Vision
translation:
  selectedService: deepL # Selected translation service: 'deepL' or 'google'
  sourceLanguage: JA # OPTIONAL: The source language ISO-639-1 code. If omitted, the source language is automatically detected.
  targetLanguage: EN-US # The target language ISO-639-1 code.
  google:
    apiKey: abcdef123456 # Cloud Translation API key
  deepL:
    apiKey: abcdef123456 # DeepL API key

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(modify bool)

Create initiates an interactive setup for the config file. The "modify" parameter specifies if the setup is being used to modify an exiting config instead of staring from scratch.

func Path

func Path() string

Path returns the absolute path to the manga-translator files directory.

func SaveConfig

func SaveConfig(cfg File)

SaveConfig saves the given ConfigFile object in "mtl/mtl-config.yml".

func Setup

func Setup(configPath string, cfg *File)

Setup loads the config at the given path into the given config object.

Types

type File

type File struct {
	CloudVision struct {
		CredentialsPath string `yaml:"credentialsPath"`
	} `yaml:"cloudVision"`
	Translation struct {
		SelectedService string `yaml:"selectedService"`
		SourceLanguage  string `yaml:"sourceLanguage,omitempty"`
		TargetLanguage  string `yaml:"targetLanguage"`
		Google          struct {
			APIKey string `yaml:"apiKey,omitempty"`
		} `yaml:"google,omitempty"`
		DeepL struct {
			APIKey string `yaml:"apiKey,omitempty"`
		} `yaml:"deepL,omitempty"`
	} `yaml:"translation"`
}

File is the mtl/mtl-config.yml structure.

Jump to

Keyboard shortcuts

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