mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-06 22:27:22 +00:00
Merge pull request #1377 from Infisical/allow-name-initial-org
add initial org rename
This commit is contained in:
@@ -19,6 +19,7 @@ const envSchema = z
|
|||||||
DB_ROOT_CERT: zpStr(z.string().describe("Postgres database base64-encoded CA cert").optional()),
|
DB_ROOT_CERT: zpStr(z.string().describe("Postgres database base64-encoded CA cert").optional()),
|
||||||
NODE_ENV: z.enum(["development", "test", "production"]).default("production"),
|
NODE_ENV: z.enum(["development", "test", "production"]).default("production"),
|
||||||
SALT_ROUNDS: z.coerce.number().default(10),
|
SALT_ROUNDS: z.coerce.number().default(10),
|
||||||
|
INITIAL_ORGANIZATION_NAME: zpStr(z.string().optional()),
|
||||||
// TODO(akhilmhdh): will be changed to one
|
// TODO(akhilmhdh): will be changed to one
|
||||||
ENCRYPTION_KEY: zpStr(z.string().optional()),
|
ENCRYPTION_KEY: zpStr(z.string().optional()),
|
||||||
ROOT_ENCRYPTION_KEY: zpStr(z.string().optional()),
|
ROOT_ENCRYPTION_KEY: zpStr(z.string().optional()),
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { TSuperAdmin, TSuperAdminUpdate } from "@app/db/schemas";
|
import { TSuperAdmin, TSuperAdminUpdate } from "@app/db/schemas";
|
||||||
|
import { getConfig } from "@app/lib/config/env";
|
||||||
import { BadRequestError } from "@app/lib/errors";
|
import { BadRequestError } from "@app/lib/errors";
|
||||||
|
|
||||||
import { TAuthLoginFactory } from "../auth/auth-login-service";
|
import { TAuthLoginFactory } from "../auth/auth-login-service";
|
||||||
@@ -58,6 +59,7 @@ export const superAdminServiceFactory = ({
|
|||||||
ip,
|
ip,
|
||||||
userAgent
|
userAgent
|
||||||
}: TAdminSignUpDTO) => {
|
}: TAdminSignUpDTO) => {
|
||||||
|
const appCfg = getConfig();
|
||||||
const existingUser = await userDAL.findOne({ email });
|
const existingUser = await userDAL.findOne({ email });
|
||||||
if (existingUser) throw new BadRequestError({ name: "Admin sign up", message: "User already exist" });
|
if (existingUser) throw new BadRequestError({ name: "Admin sign up", message: "User already exist" });
|
||||||
|
|
||||||
@@ -91,7 +93,10 @@ export const superAdminServiceFactory = ({
|
|||||||
);
|
);
|
||||||
return { user: newUser, enc: userEnc };
|
return { user: newUser, enc: userEnc };
|
||||||
});
|
});
|
||||||
await orgService.createOrganization(userInfo.user.id, userInfo.user.email, "Admin Org");
|
|
||||||
|
const initialOrganizationName = appCfg.INITIAL_ORGANIZATION_NAME ?? "Admin Org";
|
||||||
|
|
||||||
|
await orgService.createOrganization(userInfo.user.id, userInfo.user.email, initialOrganizationName);
|
||||||
|
|
||||||
await updateServerCfg({ initialized: true });
|
await updateServerCfg({ initialized: true });
|
||||||
const token = await authService.generateUserTokens(userInfo.user, ip, userAgent);
|
const token = await authService.generateUserTokens(userInfo.user, ip, userAgent);
|
||||||
|
|||||||
Reference in New Issue
Block a user