Skip to content

Conversation

@liuzewen99
Copy link
Collaborator

No description provided.

@liuzewen99 liuzewen99 force-pushed the fix-nasConfig branch 3 times, most recently from 7125074 to abbd147 Compare January 19, 2026 10:16
enableInstanceMetrics: true
enableRequestMetrics: true
logBeginRule: DefaultRegex
enableInstanceMetrics: ${customFields.enableInstanceMetrics}
Copy link
Contributor

Choose a reason for hiding this comment

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

这个感觉有点问题啊,不应该是跟 376-380 行一样的逻辑吗

const { project, logstore } = await sls.deploy();
const logAutoConfig = parseAutoConfig(this.local.logConfig as string);
const logParams = logAutoConfig?.params || {};
const existingLogConfig =
Copy link
Contributor

Choose a reason for hiding this comment

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

这里已经是 sls Auto 的逻辑了, 为什么还有 existingLogConfig?

handler: index.handler
memorySize: 128
timeout: 60
nasConfig: auto|mountDir=/custom/nas/mount/path|serverAddr=/custom/nas/mount/path
Copy link
Contributor

@rsonghuster rsonghuster Jan 19, 2026

Choose a reason for hiding this comment

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

mountDir 一般是 /home 或者 /mnt 开头, 你这个测试起来应该跑不过

Image

const customMountDir = params.mountDir
? validateAndNormalizePath(params.mountDir, 'mountDir')
: `/mnt/${functionName}`;
const customServerAddr = params.serverAddr ? params.serverAddr : `${functionName}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

这个 params.serverAddr 名字叫 params.nasDir 更容易理解点, 而且和 fc 的 serverAddr 没有冲突

let serverAddr = `${mountTargetDomain}:/${functionName}`;
const nasAutoConfig = parseAutoConfig(this.local.nasConfig as string);
const params = nasAutoConfig?.params || {};
const customMountDir = params.mountDir
Copy link
Contributor

Choose a reason for hiding this comment

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

customMountDir 改成 fcDir 吧,更容易理解点

const nasAutoConfig = parseAutoConfig(this.local.nasConfig as string);
const params = nasAutoConfig?.params || {};
const customMountDir = params.mountDir
? validateAndNormalizePath(params.mountDir, 'mountDir')
Copy link
Contributor

@rsonghuster rsonghuster Jan 19, 2026

Choose a reason for hiding this comment

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

如果这个函数仅仅是校验 fcDir

Image

我建议使用更科学的代码, 比如:

  1. 必须是 / 开头
  2. /mnt/ 和 /mnt 这种没有子目录的不被允许
  3. 这些前缀开头不被允许
    [
    '/bin', '/boot', '/dev', '/etc', '/lib', '/lib64',
    '/media', '/opt', '/proc', '/root', '/run',
    '/sbin', '/srv', '/sys', '/usr', '/var'
    ]
  4. 长度不要超过 128

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants