Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Backend-MECRED
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MECRED
Backend-MECRED
Commits
549c7397
Commit
549c7397
authored
2 weeks ago
by
Richard Fernando Heise Ferreira
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#71
: ADD production envs
parent
1fb77d4e
No related branches found
No related tags found
1 merge request
!72
Issue #71: ADD production envs
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.env.example
+3
-2
3 additions, 2 deletions
.env.example
package.json
+1
-1
1 addition, 1 deletion
package.json
src/db/index.ts
+1
-0
1 addition, 0 deletions
src/db/index.ts
src/db/repo/auth.repo.ts
+4
-4
4 additions, 4 deletions
src/db/repo/auth.repo.ts
with
9 additions
and
7 deletions
.env.example
+
3
−
2
View file @
549c7397
...
...
@@ -6,7 +6,7 @@ DB_HOST=localhost
DB_USER=postgres
DB_PASSWORD=postgres
DB_NAME=hono_db
DB_PORT=543
3
DB_PORT=543
2
# Usually a URL is used for connections
DB_URL=postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_NAME}
...
...
@@ -16,7 +16,7 @@ MAILER_HOST=smtp.c3sl.ufpr.br
# Mailer service port
MAILER_PORT=25
# URL used for email riderecting, this should be the frontend site name like "https://mecred.c3sl.ufpr.br"
URL=EmailURL
EMAIL_
URL=EmailURL
# secret used for JWT and crypt
APP_SECRET=VeryLongUniqueSecret
...
...
@@ -47,5 +47,6 @@ GOVBR_SECRET=
GOVBR_AUTHORIZE_URL=
GOVBR_TOKEN_URL=
GOVBR_PUBLIC_KEY_URL=
GOVBR_SERVER_URL=
FRONT_END_RETURN_URL=
This diff is collapsed.
Click to expand it.
package.json
+
1
−
1
View file @
549c7397
{
"name"
:
"hono-backend"
,
"scripts"
:
{
"dev"
:
"bun run
--port '3000'
--hot --watch src/index.ts"
,
"dev"
:
"bun run --hot --watch src/index.ts
--port '4000'
"
,
"db:generate"
:
"drizzle-kit generate"
,
"db:migrate"
:
"cross-env DB_MIGRATING=true bun run src/db/migrate.ts"
,
"db:seed"
:
"cross-env DB_SEEDING=true bun run src/db/seed.ts"
,
...
...
This diff is collapsed.
Click to expand it.
src/db/index.ts
+
1
−
0
View file @
549c7397
...
...
@@ -6,6 +6,7 @@ import env from '@/env'
export
const
connection
=
postgres
(
env
.
DB_URL
,
{
max
:
env
.
DB_MIGRATING
||
env
.
DB_SEEDING
?
1
:
undefined
,
onnotice
:
env
.
DB_SEEDING
?
()
=>
{}
:
undefined
,
ssl
:
env
.
NODE_ENV
===
'
production
'
?
true
:
false
,
})
export
const
db
=
drizzle
(
connection
,
{
...
...
This diff is collapsed.
Click to expand it.
src/db/repo/auth.repo.ts
+
4
−
4
View file @
549c7397
import
type
{
z
}
from
'
zod
'
import
{
userSchemas
,
type
UserModel
}
from
'
../schema/user.schema
'
import
env
from
'
@/env
'
export
function
hashPassword
(
pass
:
UserModel
[
'
password
'
])
{
if
(
pass
!==
null
)
return
Bun
.
password
.
hashSync
(
pass
,
{
memoryCost
:
4
,
timeCost
:
3
,
algorithm
:
'
argon2id
'
,
algorithm
:
'
bcrypt
'
,
cost
:
env
.
NODE_ENV
===
'
production
'
?
12
:
10
})
else
return
null
;
...
...
@@ -16,7 +16,7 @@ export function verifyPassword(
pass
:
UserModel
[
'
password
'
],
hash
:
UserModel
[
'
password
'
]
)
{
return
Bun
.
password
.
verifySync
(
pass
,
hash
)
return
Bun
.
password
.
verifySync
(
pass
,
hash
,
'
bcrypt
'
)
}
export
const
authSchema
=
userSchemas
.
userModelSchema
.
pick
({
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment