[#466] adm: Allow to download contracts from Gitea

Signed-off-by: Olga Konstantinova <kola43843@gmail.com>
This commit is contained in:
Olga Konstantinova 2024-02-03 20:17:12 +03:00 committed by okonstantinova
parent 805862f4b7
commit 80b581d499
6 changed files with 129 additions and 7 deletions

View file

@ -399,10 +399,14 @@ func (c *initializeContext) readContracts(names []string) error {
}
} else {
var r io.ReadCloser
if c.ContractPath == "" {
return errors.New("contracts flag is missing")
if c.ContractPath != "" {
r, err = os.Open(c.ContractPath)
} else if c.ContractURL != "" {
r, err = downloadContracts(c.Command, c.ContractURL)
} else {
r, err = downloadContractsFromRepository(c.Command)
}
r, err = os.Open(c.ContractPath)
if err != nil {
return fmt.Errorf("can't open contracts archive: %w", err)
}