Skip to content
This repository has been archived by the owner on Jul 14, 2022. It is now read-only.

Feat/workflow db #53

Merged
merged 12 commits into from
Aug 26, 2021
Merged

Feat/workflow db #53

merged 12 commits into from
Aug 26, 2021

Conversation

UchicagoZchen138
Copy link
Contributor

@UchicagoZchen138 UchicagoZchen138 commented Aug 13, 2021

The change is the work for PXP-8095 which will set up a db interface layer to interact with a psql db that mariner will talk to. unit tests have been added and no breaking changes introduced.

mariner/psqldb.go Outdated Show resolved Hide resolved
@UchicagoZchen138 UchicagoZchen138 force-pushed the feat/workflow-db branch 5 times, most recently from dc75663 to 9aac2a3 Compare August 17, 2021 22:44
@UchicagoZchen138 UchicagoZchen138 force-pushed the feat/workflow-db branch 5 times, most recently from e673da8 to 47d67ee Compare August 19, 2021 18:12
"os"

log "github.com/sirupsen/logrus"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

db.DBName = credential.DatabaseName
}

func (db *PSQLDataBase) Initalize() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A common Go pattern is to use Must<DoSomething> for method/function names to imply that something must occur and if an error happens the app will crash. We may want to do that here. Right now, getCredentials does nothing if it finds errors. I think it should probably return an err and we should log.Fatal if an err exists


func (db *PSQLDataBase) Connect() (string, error) {
psqlInfo := fmt.Sprintf("host=%s user=%s "+
"password=%s dbname=%s sslmode=disable", //pragma: allowlist secret

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we not able to use ssl today?

database/psqldb.go Outdated Show resolved Hide resolved
@UchicagoZchen138 UchicagoZchen138 force-pushed the feat/workflow-db branch 18 times, most recently from 2966787 to 1d15505 Compare August 24, 2021 21:38
README.md Outdated Show resolved Hide resolved
@UchicagoZchen138 UchicagoZchen138 force-pushed the feat/workflow-db branch 2 times, most recently from 5977b38 to 3d5311c Compare August 25, 2021 21:05
return 0, fmt.Errorf("could not create user")
}

log.Infof("Sucessfully created user with name %s and email %s", name, email)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Infof("Sucessfully created user with name %s and email %s", name, email)
log.Infof("Sucessfully created user with id %d", userId)

We should avoid logging potentially sensitive user information. Either of these fields could be considered PII

return fmt.Errorf("update user failed")
}

log.Infof("User %s updated successfully", user.Name)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
log.Infof("User %s updated successfully", user.Name)
log.Infof("User %d updated successfully", user.ID)

Copy link

@williamhaley williamhaley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense to me! I'm sure there may be changes as we integrate the DB work, but great start 👍

@UchicagoZchen138 UchicagoZchen138 merged commit 2100440 into master Aug 26, 2021
@UchicagoZchen138 UchicagoZchen138 deleted the feat/workflow-db branch August 26, 2021 18:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants