I was trying to add a custom log path but I had the wrong JSON syntax in the config file. When I ran valet log to check that my new log was there my entire config was reset to the default config.
Expected behavior
I expected an error about an incorrect configuration option.
Current behavior
When I ran valet log, my config went from this bad config (note the square brackets instead of curly for logs key):
Add "logs": [] to the bottom of the $HOME/.config/valet/config.json file
Run valet log
Output of these steps
See that your config has been reset to the default config file without any notification that your configuration file has been reset or was bad to begin with.
Possible solution
Throw an error instead of silently wiping out the configuration.
Diagnosis
sw_vers
ProductName: Mac OS X
ProductVersion: 10.15.4
BuildVersion: 19E287
Changed current directory to /Users/cjone0102/.composer
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.squizlabs/php_codesniffer : exact version constraints (2.9.4) should be avoided if the package follows semantic versioning
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 1.10.6
PHP version: 7.2.30
PHP binary path: /usr/local/Cellar/php@7.2/7.2.30_1/bin/php
OpenSSL version: OpenSSL 1.1.1g 21 Apr 2020
composer global outdated
Changed current directory to /Users/cjone0102/.composer
Your configuration does not allow connections to http://internal-satis-server1/packages.json. See https://getcomposer.org/doc/06-config.md#secure-http for details.
http://internal-satis-server1 could not be fully loaded, package information was loaded from the local cache and may be out of date
1/9: http://repo.packagist.org/p/provider-2019-07$3f98e2dd56e1ab563186ad00f96fb9ee679f861783c545c185a226c2b6e0f0b7.json
2/9: http://repo.packagist.org/p/provider-2019-10$220cb5f6890905ef38a4260ef740d8366853b7378e86164cc4d06546ed3bf43a.json
3/9: http://repo.packagist.org/p/provider-2015$0025df94ff6acfbbbb652e96795974ff20df68f494f95bf624f5c7e7d188b30a.json
4/9: http://repo.packagist.org/p/provider-latest$32cc3a628f58b3dbf5cd1e707edd2cc6bfa0a3a230f2847bd323fd07b46967f0.json
5/9: http://repo.packagist.org/p/provider-2020-04$546db06d72593910ab23c6f2412d06a6470dc644b7324e5bff8dc45e7c99ceb6.json
6/9: http://repo.packagist.org/p/provider-2019$d622c89d802dfdf922323984d053a2f91720f8ded7cb3642a86c329ab9804cb8.json
7/9: http://repo.packagist.org/p/provider-2020-01$795b25cde112c7dac7ffa42a2a7fa47a41a0d8d85bc9fbbcb1e21a211196285f.json
8/9: http://repo.packagist.org/p/provider-2018$3a0b800e5e97b70d1000e26a6297c38512a409c3f7d802207acf6cf5371623da.json
9/9: http://repo.packagist.org/p/provider-2017$e1a89d199576cc40f9e06e3d3f1a3b9ac70494f4baa938b9c4131320c5a76660.json
Finished: success: 9, skipped: 0, failure: 0, total: 9
amphp/amp v2.4.0 ! v2.4.4 A non-blocking concurr...
amphp/byte-stream v1.7.2 ! v1.7.3 A stream abstraction t...
composer/semver 1.5.1 ~ 2.0.0 Semver library that of...
composer/xdebug-handler 1.4.0 ! 1.4.1 Restarts a process wit...
felixfbecker/advanced-json-rpc v3.0.4 ! v3.1.1 A more advanced JSONRP...
hirak/prestissimo 0.3.9 ! 0.3.10 composer parallel inst...
illuminate/container v7.10.3 ! v7.11.0 The Illuminate Contain...
illuminate/contracts v7.10.3 ! v7.11.0 The Illuminate Contrac...
jean85/pretty-package-versions 1.2 ! 1.3.0 A wrapper for ocramius...
localheinz/composer-json-normalizer 1.0.2 ~ 2.0.1 Provides normalizers f...
Package localheinz/composer-json-normalizer is abandoned, you should avoid using it. Use ergebnis/composer-json-normalizer instead.
localheinz/composer-normalize 1.3.1 ~ 2.5.1 Provides a composer pl...
Package localheinz/composer-normalize is abandoned, you should avoid using it. Use ergebnis/composer-normalize instead.
localheinz/json-normalizer 0.9.0 ~ 0.12.0 Provides normalizers f...
Package localheinz/json-normalizer is abandoned, you should avoid using it. Use ergebnis/json-normalizer instead.
localheinz/json-printer 2.0.1 ~ 3.0.2 Provides a JSON printe...
Package localheinz/json-printer is abandoned, you should avoid using it. Use ergebnis/json-printer instead.
myclabs/deep-copy 1.9.3 ! 1.9.5 Create deep copies (cl...
netresearch/jsonmapper v1.6.0 ~ v2.1.0 Map nested JSON struct...
nette/neon v3.1.0 ! v3.1.2 🍸 Nette NEON: encod...
nette/php-generator v3.3.3 ! v3.3.4 🐘 Nette PHP Generat...
nette/robot-loader v3.2.1 ! v3.2.3 🍀 Nette RobotLoader...
nette/utils v3.1.0 ! v3.1.1 🛠 Nette Utils: ligh...
nikic/php-parser v4.3.0 ! v4.4.0 A PHP parser written i...
phar-io/manifest 1.0.3 ~ 2.0.0 Component for reading ...
phar-io/version 2.0.1 ~ 3.0.1 Library for handling v...
phpdocumentor/reflection-common 2.0.0 ! 2.1.0 Common reflection clas...
phpdocumentor/reflection-docblock 4.3.4 ~ 5.1.0 With this component, a...
phpdocumentor/type-resolver 1.0.1 ! 1.1.0 A PSR-5 based resolver...
phpstan/phpdoc-parser 0.3.5 ~ 0.4.7 PHPDoc parser with sup...
phpstan/phpstan 0.11.19 ~ 0.12.25 PHPStan - PHP Static A...
phpstan/phpstan-doctrine 0.11.6 ~ 0.12.12 Doctrine extensions fo...
phpstan/phpstan-phpunit 0.11.2 ~ 0.12.8 PHPUnit extensions and...
phpstan/phpstan-symfony 0.11.6 ~ 0.12.6 Symfony Framework exte...
phpunit/phpunit 8.5.2 ! 8.5.4 The PHP Unit Testing f...
psr/log 1.1.2 ! 1.1.3 Common interface for l...
squizlabs/php_codesniffer 2.9.4 ~ 3.5.5 PHP_CodeSniffer tokeni...
symfony/console v4.4.4 ~ v5.0.8 Symfony Console Component
symfony/finder v4.4.4 ~ v5.0.8 Symfony Finder Component
symfony/polyfill-ctype v1.13.1 ! v1.17.0 Symfony polyfill for c...
symfony/polyfill-mbstring v1.13.1 ! v1.17.0 Symfony polyfill for t...
symfony/polyfill-php73 v1.13.1 ! v1.17.0 Symfony polyfill backp...
vimeo/psalm 3.10.1 ! 3.11.4 A static analysis tool...
webmozart/assert 1.6.0 ! 1.8.0 Assertions to validate...
ls -al /etc/sudoers.d/
total 16
drwxr-xr-x 4 root wheel 128 May 11 14:18 .
drwxr-xr-x 95 root wheel 3040 May 13 09:09 ..
-rw-r--r-- 1 root wheel 80 May 11 14:18 brew
-rw-r--r-- 1 root wheel 83 May 11 14:18 valet
brew config
HOMEBREW_VERSION: 2.2.16-28-gfa980e9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: fa980e9c427b41db245a15c4bbcd510963b52169
Last commit: 2 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: e33e3cbe24a510b331eef007b73829df2c621d30
Core tap last commit: 8 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_EDITOR: nvim
HOMEBREW_MAKE_JOBS: 8
CPU: octa-core 64-bit kabylake
Homebrew Ruby: 2.6.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.6.3/bin/ruby
Clang: 11.0 build 1103
Git: 2.25.0 => /usr/local/bin/git
Curl: 7.64.1 => /usr/bin/curl
Java: 12.0.1, 10.0.2, 1.8.0_181
macOS: 10.15.4-x86_64
CLT: 11.0.33.17
Xcode: 11.4
brew services list
Name Status User Plist
caddy stopped
dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
emacs started cjone0102 /Users/cjone0102/Library/LaunchAgents/homebrew.mxcl.emacs.plist
httpd stopped
memcached started cjone0102 /Users/cjone0102/Library/LaunchAgents/homebrew.mxcl.memcached.plist
mysql stopped
mysql@5.7 started cjone0102 /Users/cjone0102/Library/LaunchAgents/homebrew.mxcl.mysql@5.7.plist
nginx started root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php stopped
php@7.2 started root /Library/LaunchDaemons/homebrew.mxcl.php@7.2.plist
postgresql stopped
unbound stopped
vault stopped
brew list --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s"
curl
cURL support => enabled
cURL Information => 7.70.0
Age => 6
Features
AsynchDNS => Yes
CharConv => No
Debug => No
GSS-Negotiate => No
IDN => No
IPv6 => Yes
krb4 => No
Largefile => Yes
libz => Yes
NTLM => Yes
NTLMWB => Yes
SPNEGO => Yes
SSL => Yes
SSPI => No
TLS-SRP => Yes
HTTP2 => Yes
GSSAPI => Yes
KERBEROS5 => Yes
UNIX_SOCKETS => Yes
PSL => No
Protocols => dict, file, ftp, ftps, gopher, http, https, imap, imaps, ldap, ldaps, pop3, pop3s, rtmp, rtsp, scp, sftp, smb, smbs, smtp, smtps, telnet, tftp
Host => x86_64-apple-darwin19.4.0
SSL Version => OpenSSL/1.1.1g
ZLib Version => 1.2.11
libSSH Version => libssh2/1.9.0
~/.composer/vendor/laravel/valet/bin/ngrok version
ngrok version 2.3.35
ls -al ~/.ngrok2
ls: /Users/cjone0102/.ngrok2: No such file or directory
brew info nginx
nginx: stable 1.17.10 (bottled), HEAD
HTTP(S) server and reverse proxy, and IMAP/POP3 proxy server
https://nginx.org/
/usr/local/Cellar/nginx/1.17.2 (25 files, 2MB) *
Poured from bottle on 2019-07-30 at 14:12:49
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/nginx.rb
==> Dependencies
Required: openssl@1.1, pcre
==> Options
--HEAD
Install HEAD version
==> Caveats
Docroot is: /usr/local/var/www
The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.
nginx will load all files in /usr/local/etc/nginx/servers/.
To have launchd start nginx now and restart at login:
brew services start nginx
Or, if you don't want/need a background service you can just run:
nginx
==> Analytics
install: 37,633 (30 days), 103,525 (90 days), 411,088 (365 days)
install-on-request: 36,393 (30 days), 100,193 (90 days), 395,075 (365 days)
build-error: 0 (30 days)
brew info php
php: stable 7.4.5 (bottled), HEAD
General-purpose scripting language
https://www.php.net/
/usr/local/Cellar/php/7.4.5_2 (517 files, 76MB)
Poured from bottle on 2020-05-11 at 14:04:38
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/php.rb
==> Dependencies
Build: httpd, pkg-config
Required: apr, apr-util, argon2, aspell, autoconf, curl-openssl, freetds, freetype, gettext, glib, gmp, icu4c, jpeg, libffi, libpng, libpq, libsodium, libzip, oniguruma, openldap, openssl@1.1, sqlite, tidy-html5, unixodbc, webp
==> Options
--HEAD
Install HEAD version
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php/lib/httpd/modules/libphp7.so
SetHandler application/x-httpd-php
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.4/
To have launchd start php now and restart at login:
brew services start php
Or, if you don't want/need a background service you can just run:
php-fpm
==> Analytics
install: 53,825 (30 days), 134,474 (90 days), 491,233 (365 days)
install-on-request: 50,350 (30 days), 125,394 (90 days), 454,224 (365 days)
build-error: 0 (30 days)
brew info openssl
openssl@1.1: stable 1.1.1g (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@1.1/1.1.1d (7,983 files, 18.2MB)
Poured from bottle on 2019-09-27 at 11:24:03
/usr/local/Cellar/openssl@1.1/1.1.1g (8,061 files, 18MB)
Poured from bottle on 2020-04-30 at 12:09:40
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/openssl@1.1.rb
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs
and run
/usr/local/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"
==> Analytics
install: 952,074 (30 days), 2,045,900 (90 days), 5,164,196 (365 days)
install-on-request: 155,013 (30 days), 307,519 (90 days), 724,513 (365 days)
build-error: 0 (30 days)
openssl version -a
LibreSSL 2.8.3
built on: date not available
platform: information not available
options: bn(64,64) rc4(16x,int) des(idx,cisc,16,int) blowfish(idx)
compiler: information not available
OPENSSLDIR: "/private/etc/ssl"
nginx: the configuration file /usr/local/etc/nginx/nginx.conf syntax is ok
nginx: configuration file /usr/local/etc/nginx/nginx.conf test is successful
Clear description of your problem
I was trying to add a custom log path but I had the wrong JSON syntax in the config file. When I ran
valet log
to check that my new log was there my entire config was reset to the default config.Expected behavior
I expected an error about an incorrect configuration option.
Current behavior
When I ran
valet log
, my config went from this bad config (note the square brackets instead of curly for logs key):To the default config of this:
Steps to Reproduce
"logs": []
to the bottom of the$HOME/.config/valet/config.json
filevalet log
Output of these steps
See that your config has been reset to the default config file without any notification that your configuration file has been reset or was bad to begin with.
Possible solution
Throw an error instead of silently wiping out the configuration.
Diagnosis
sw_vers
valet --version
cat ~/.config/valet/config.json
cat ~/.composer/composer.json
composer global diagnose
composer global outdated
ls -al /etc/sudoers.d/
brew config
brew services list
brew list --versions | grep -E "(php|nginx|dnsmasq|mariadb|mysql|mailhog|openssl)(@\d\..*)?\s"
brew outdated
php -v
which -a php
php --ini
nginx -v
curl --version
php --ri curl
~/.composer/vendor/laravel/valet/bin/ngrok version
ls -al ~/.ngrok2
brew info nginx
brew info php
brew info openssl
openssl version -a
openssl ciphers
sudo nginx -t
which -a php-fpm
/usr/local/opt/php/sbin/php-fpm -v
sudo /usr/local/opt/php/sbin/php-fpm -y /usr/local/etc/php/7.2/php-fpm.conf --test
ls -al ~/Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchAgents | grep homebrew
ls -al /Library/LaunchDaemons | grep homebrew