Skip to content

Commit

Permalink
Look for certificates in valet linux config directory (#307)
Browse files Browse the repository at this point in the history
* Look for certificates in valet linux config directory

* Prefix mac valet function

* Show log message on linux

---------

Co-authored-by: Tim MacDonald <hello@timacdonald.me>
  • Loading branch information
jameshulse and timacdonald authored Nov 11, 2024
1 parent 7252168 commit 5a9cf20
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ function resolveLaravelPlugin(pluginConfig: Required<PluginConfig>): LaravelPlug
server.config.logger.info(` ${colors.green('➜')} Using Herd certificate to secure Vite.`)
}

if (resolvedConfig.server.https.key.startsWith(valetConfigPath())) {
if (resolvedConfig.server.https.key.startsWith(valetMacConfigPath()) || resolvedConfig.server.https.key.startsWith(valetLinuxConfigPath())) {
server.config.logger.info(` ${colors.green('➜')} Using Valet certificate to secure Vite.`)
}
}
Expand Down Expand Up @@ -580,8 +580,12 @@ function determineDevelopmentEnvironmentConfigPath(): string|undefined {
return herdWindowsConfigPath()
}

if (fs.existsSync(valetConfigPath())) {
return valetConfigPath()
if (fs.existsSync(valetMacConfigPath())) {
return valetMacConfigPath()
}

if (fs.existsSync(valetLinuxConfigPath())) {
return valetLinuxConfigPath()
}
}

Expand Down Expand Up @@ -622,8 +626,15 @@ function herdWindowsConfigPath(): string {
}

/**
* Valet's configuration directory.
* Valet's Mac configuration directory.
*/
function valetConfigPath(): string {
function valetMacConfigPath(): string {
return path.resolve(os.homedir(), '.config', 'valet')
}

/**
* Valet Linux's configuration directory.
*/
function valetLinuxConfigPath(): string {
return path.resolve(os.homedir(), '.valet')
}

0 comments on commit 5a9cf20

Please sign in to comment.