Currently the merging process is not working entirely as I would expect. There are no checks for actual changes between the local version and the server version. WIP for #3. Configuration file created with corresponding values like, user name and access code, which are - for obvious reasons - not commited.
34 lines
565 B
Go
34 lines
565 B
Go
package gitea
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"os"
|
|
)
|
|
|
|
var API_PATH = "/api/v1"
|
|
|
|
type Gitea struct {
|
|
Base_url string `json:"base_url"`
|
|
User_name string `json:"user_name"`
|
|
Access_code string `json:"access_code"`
|
|
}
|
|
|
|
func NewGitea() (gitea Gitea) {
|
|
configJson, err := os.ReadFile("./configs/gitw.json")
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(-1)
|
|
}
|
|
err = json.Unmarshal(configJson, &gitea)
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, err)
|
|
os.Exit(-1)
|
|
}
|
|
return
|
|
}
|
|
|
|
func (gitea *Gitea) Url() string {
|
|
return gitea.Base_url + API_PATH
|
|
}
|