create .ollama
directory if it doesnt exist
This commit is contained in:
parent
4e07941b1e
commit
148f0225c0
1 changed files with 7 additions and 3 deletions
|
@ -9,7 +9,6 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
@ -62,9 +61,14 @@ func getAuthToken(redirData AuthRedirect, regOpts *RegistryOptions) (string, err
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
keyPath := path.Join(home, ".ollama/id_ed25519")
|
keyPath := path.Join(home, ".ollama", "id_ed25519")
|
||||||
|
|
||||||
rawKey, err := ioutil.ReadFile(keyPath)
|
err = os.MkdirAll(path.Dir(keyPath), 0700)
|
||||||
|
if err != nil {
|
||||||
|
return "", fmt.Errorf("could not create .ollama directory %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
rawKey, err := os.ReadFile(keyPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("Failed to load private key: %v", err)
|
log.Printf("Failed to load private key: %v", err)
|
||||||
return "", err
|
return "", err
|
||||||
|
|
Loading…
Add table
Reference in a new issue