Skip to content

Commit

Permalink
fix: cli补充redis (#211)
Browse files Browse the repository at this point in the history
* fix: cli补充redis

* fix: cli去除console
  • Loading branch information
Muyu-art authored Sep 18, 2024
1 parent 0c04612 commit cd634db
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 17 additions & 3 deletions packages/toolkits/pro/src/lib/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ const getProjectInfo = (): Promise<ProjectInfo> => {
answers.framework === VUE_TEMPLATE_PATH &&
answers.serverFramework !== ServerFrameworks.Skip,
},
{
type: 'input',
name: 'redisHost',
message: '请输入Redis地址:',
default: 'localhost',
prefix: '*',
},
{
type: 'input',
name: 'redisPort',
message: '请输入Redis端口:',
default: 6379,
prefix: '*',
},
{
type: 'list',
name: 'dialect',
Expand Down Expand Up @@ -164,16 +178,16 @@ const createServerSync = (answers: ProjectInfo) => {
const serverTo = utils.getDistPath(`${name}/${serverFramework}`);
const config = {
DATABASE_HOST: answers.host ?? 'localhost',
DATABASE_PORT: 3306,
DATABASE_PORT: Number(answers.port ?? 3306),
DATABASE_USERNAME: answers.username ?? 'root',
DATABASE_PASSWORD: answers.password ?? 'root',
DATABASE_NAME: answers.database,
DATABASE_SYNCHRONIZE: false,
DATABASE_AUTOLOADENTITIES: true,
AUTH_SECRET: 'secret',
REDIS_SECONDS: 7200,
REDIS_HOST: 'localhost',
REDIS_PORT: 6379,
REDIS_HOST: answers.redisHost ?? 'localhost',
REDIS_PORT: Number(answers.redisPort ?? 6379),
EXPIRES_IN: '2h',
PAGINATION_PAGE: 1,
PAGINATION_LIMIT: 10,
Expand Down
2 changes: 2 additions & 0 deletions packages/toolkits/pro/src/lib/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ export interface ProjectInfo {
database?: string;
username?: string;
password?: string;
redisHost?: string;
redisPort?: number;
buildTool: BuildTool;
vueVersion: VueVersion;
}

0 comments on commit cd634db

Please sign in to comment.