refactor(resources): вынести embed-конфиги в корневой resources
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,19 +1,14 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"git.tswf.io/infra/go-synapse-backupper/resources"
|
||||
)
|
||||
|
||||
//go:embed resources/config.en.yaml
|
||||
var configEnYAML []byte
|
||||
|
||||
//go:embed resources/config.ru.yaml
|
||||
var configRuYAML []byte
|
||||
|
||||
func generateConfigCmd() *cobra.Command {
|
||||
var lang string
|
||||
var output string
|
||||
@@ -25,9 +20,9 @@ func generateConfigCmd() *cobra.Command {
|
||||
var tmpl []byte
|
||||
switch lang {
|
||||
case "en":
|
||||
tmpl = configEnYAML
|
||||
tmpl = resources.ConfigEnYAML
|
||||
case "ru":
|
||||
tmpl = configRuYAML
|
||||
tmpl = resources.ConfigRuYAML
|
||||
default:
|
||||
return fmt.Errorf("unsupported language: %q (must be \"en\" or \"ru\")", lang)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package resources
|
||||
|
||||
import _ "embed"
|
||||
|
||||
// ConfigEnYAML is the embedded English example configuration file.
|
||||
//
|
||||
//go:embed config.en.yaml
|
||||
var ConfigEnYAML []byte
|
||||
|
||||
// ConfigRuYAML is the embedded Russian example configuration file.
|
||||
//
|
||||
//go:embed config.ru.yaml
|
||||
var ConfigRuYAML []byte
|
||||
Reference in New Issue
Block a user