Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix env in Dockerfile.immuadmin and issue in connect() function #1968

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading