surrealdb / surrealist

Surrealist is the ultimate way to visually manage your SurrealDB database
https://surrealist.app/
MIT License
1.08k stars 83 forks source link

feature: Have config.json pretty printed #275

Closed winksaville closed 4 months ago

winksaville commented 4 months ago

Using jsonxf to pretty print config.json when saving.

winksaville commented 4 months ago

I believe having config.json pretty printed makes it more useful for humans.

I've chosen jsonxf simply because when searching crates.io it was most relevant and had almost 100,000 downloads. Another obvious choice would be to use serde_json::to_string_pretty but since serde wasn't being used currently I thought maybe there was a reason not to so looked for another alternative.

winksaville commented 4 months ago

Rebased and altered this PR to build on main. In that surrealdb/src-tauri/Cargo.toml now has serde & serde_json as dependencies I switched to using serde_json::to_string_pretty, this simplifies the change and it's now only a two line change to surrealdb/src-tauri/src/config.rs.

macjuul commented 4 months ago

LGTM! Thanks!

macjuul commented 4 months ago

I have changed the implementation back to using jsonxf as serde caused the entire config to be saved as a single JSON string, corrupting it in the process 😅

winksaville commented 4 months ago

OMG, I'm so sorry :(

On Thu, May 23, 2024, 06:01 Julian @.***> wrote:

I have changed the implementation back to using jsonxf as serde caused the entire config to be saved as a single JSON string, corrupting it in the process 😅

— Reply to this email directly, view it on GitHub https://github.com/surrealdb/surrealist/pull/275#issuecomment-2127049719, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH2CHA7WZ2DESD6C56MERDZDXSB7AVCNFSM6AAAAABHYVMILOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRXGA2DSNZRHE . You are receiving this because you authored the thread.Message ID: @.***>