Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
1556162c
Commit
1556162c
authored
Aug 11, 2023
by
Jeffrey Morgan
Browse files
create `.ollama` directory if it doesnt exist
parent
148f0225
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
cmd/cmd.go
cmd/cmd.go
+8
-3
server/auth.go
server/auth.go
+0
-5
No files found.
cmd/cmd.go
View file @
1556162c
...
@@ -9,12 +9,12 @@ import (
...
@@ -9,12 +9,12 @@ import (
"errors"
"errors"
"fmt"
"fmt"
"io"
"io"
"io/ioutil"
"log"
"log"
"net"
"net"
"net/http"
"net/http"
"os"
"os"
"os/exec"
"os/exec"
"path"
"path/filepath"
"path/filepath"
"runtime"
"runtime"
"strings"
"strings"
...
@@ -585,7 +585,12 @@ func initializeKeypair() error {
...
@@ -585,7 +585,12 @@ func initializeKeypair() error {
return
err
return
err
}
}
err
=
ioutil
.
WriteFile
(
privKeyPath
,
pem
.
EncodeToMemory
(
privKeyBytes
),
0600
)
err
=
os
.
MkdirAll
(
path
.
Dir
(
privKeyPath
),
0
o700
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"could not create directory %w"
,
err
)
}
err
=
os
.
WriteFile
(
privKeyPath
,
pem
.
EncodeToMemory
(
privKeyBytes
),
0600
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
@@ -597,7 +602,7 @@ func initializeKeypair() error {
...
@@ -597,7 +602,7 @@ func initializeKeypair() error {
pubKeyData
:=
ssh
.
MarshalAuthorizedKey
(
sshPrivateKey
.
PublicKey
())
pubKeyData
:=
ssh
.
MarshalAuthorizedKey
(
sshPrivateKey
.
PublicKey
())
err
=
ioutil
.
WriteFile
(
pubKeyPath
,
pubKeyData
,
0644
)
err
=
os
.
WriteFile
(
pubKeyPath
,
pubKeyData
,
0644
)
if
err
!=
nil
{
if
err
!=
nil
{
return
err
return
err
}
}
...
...
server/auth.go
View file @
1556162c
...
@@ -63,11 +63,6 @@ func getAuthToken(redirData AuthRedirect, regOpts *RegistryOptions) (string, err
...
@@ -63,11 +63,6 @@ func getAuthToken(redirData AuthRedirect, regOpts *RegistryOptions) (string, err
keyPath
:=
path
.
Join
(
home
,
".ollama"
,
"id_ed25519"
)
keyPath
:=
path
.
Join
(
home
,
".ollama"
,
"id_ed25519"
)
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
)
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment