blob: cbb96aca1de78ece1c2754dcae2563384857baf3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
package main
// functions to import and export the protobuf
// data to and from config files
import (
"errors"
"os"
"path/filepath"
"go.wit.com/lib/config"
"go.wit.com/lib/env"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
)
func configSave() error {
// return me.configs.SavePB()
panic("not done")
}
func configInit() *forgepb.ForgeConfigs {
if argv.Hostname != "" {
HOSTNAME = argv.Hostname
}
configs := new(forgepb.ForgeConfigs)
configs.Filename = config.MakeConfigFilename("forged", "forge")
err := config.ReLoad(configs)
if errors.Is(err, os.ErrNotExist) {
env.Set("ReposDir", "/var/cache/forged")
env.Set("ReposPB", filepath.Join(env.Get("ReposDir"), "repos.pb"))
if err := configSave(); err != nil {
badExit(err)
}
log.Info("made a default config file here", configs.Filename)
okExit("")
}
if err != nil {
badExit(err)
}
return configs
}
|