-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(docker): replace anonymous docker volume with env variable for en…
…crypting secrets (#1809)
- Loading branch information
1 parent
91e1cef
commit 56b57ad
Showing
11 changed files
with
66 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { randomBytes } from "crypto"; | ||
import { createEnv } from "@t3-oss/env-nextjs"; | ||
import { z } from "zod"; | ||
|
||
const errorSuffix = `, please generate a 64 character secret in hex format or use the following: "${randomBytes(32).toString("hex")}"`; | ||
|
||
export const env = createEnv({ | ||
server: { | ||
SECRET_ENCRYPTION_KEY: z | ||
.string({ | ||
required_error: `SECRET_ENCRYPTION_KEY is required${errorSuffix}`, | ||
}) | ||
.min(64, { | ||
message: `SECRET_ENCRYPTION_KEY has to be 64 characters${errorSuffix}`, | ||
}) | ||
.max(64, { | ||
message: `SECRET_ENCRYPTION_KEY has to be 64 characters${errorSuffix}`, | ||
}) | ||
.regex(/^[0-9a-fA-F]{64}$/, { | ||
message: `SECRET_ENCRYPTION_KEY must only contain hex characters${errorSuffix}`, | ||
}), | ||
}, | ||
runtimeEnv: { | ||
SECRET_ENCRYPTION_KEY: process.env.SECRET_ENCRYPTION_KEY, | ||
}, | ||
skipValidation: | ||
Boolean(process.env.CI) || Boolean(process.env.SKIP_ENV_VALIDATION) || process.env.npm_lifecycle_event === "lint", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters