Skip to content

Commit

Permalink
Fix env in Dockerfile.immuadmin and issue in connect() function
Browse files Browse the repository at this point in the history
  • Loading branch information
ostafen committed May 3, 2024
1 parent 68b32d5 commit 865f476
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
7 changes: 4 additions & 3 deletions build/Dockerfile.immuadmin
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ COPY --from=build /src/immuadmin /usr/local/bin/immuadmin

ARG IMMU_UID="3322"
ARG IMMU_GID="3322"
ARG IMMUADMIN_TOKENFILE_PATH=/var/lib/immudb

ENV IMMUADMIN_IMMUDB_ADDRESS="127.0.0.1" \
IMMUADMIN_IMMUDB_PORT="3322" \
IMMUADMIN_MTLS="false" \
IMMUADMIN_TOKENFILE="/var/lib/immudb"
IMMUADMIN_TOKENFILE="$IMMUADMIN_TOKENFILE_PATH/token_admin"

RUN addgroup --system --gid $IMMU_GID immu && \
adduser --system --uid $IMMU_UID --no-create-home --ingroup immu immu && \
mkdir -p "$IMMUADMIN_TOKENFILE" && \
chown -R immu:immu "$IMMUADMIN_TOKENFILE" && \
mkdir -p "$IMMUADMIN_TOKENFILE_PATH" && \
chown -R immu:immu "$IMMUADMIN_TOKENFILE_PATH" && \
chmod +x /usr/local/bin/immuadmin

USER immu
Expand Down
3 changes: 1 addition & 2 deletions cmd/immuadmin/command/commandline.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,8 @@ func (cl *commandline) connect(cmd *cobra.Command, args []string) (err error) {
if cl.immuClient, err = client.NewImmuClient(cl.options); err != nil {
cl.quit(err)
}
cl.immuClient.WithTokenService(tokenservice.NewFileTokenService().WithTokenFileName("token_admin"))
cl.immuClient.WithTokenService(cl.ts)
return

}

func (cl *commandline) checkLoggedIn(cmd *cobra.Command, args []string) (err error) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/tokenservice/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ type file struct {
hds homedir.HomedirService
}

//NewFileTokenService ...
// NewFileTokenService ...
func NewFileTokenService() *file {
return &file{
tokenFileName: "token",
Expand All @@ -50,7 +50,7 @@ func (ts *file) GetToken() (string, error) {
return token, nil
}

//SetToken ...
// SetToken ...
func (ts *file) SetToken(database string, token string) error {
ts.Lock()
defer ts.Unlock()
Expand Down Expand Up @@ -78,7 +78,7 @@ func (ts *file) DeleteToken() error {
return ts.hds.DeleteFileFromUserHomeDir(ts.tokenFileName)
}

//IsTokenPresent ...
// IsTokenPresent ...
func (ts *file) IsTokenPresent() (bool, error) {
ts.Lock()
defer ts.Unlock()
Expand Down

0 comments on commit 865f476

Please sign in to comment.