Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion config/paperclip/config.template.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
{
"$meta": {
"version": 1,
"updatedAt": "2026-04-04T00:00:00.000Z",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The updatedAt field is hardcoded to a static date. It is better to use a placeholder and populate it dynamically during the hydration process to reflect the actual configuration generation time.

Suggested change
"updatedAt": "2026-04-04T00:00:00.000Z",
"updatedAt": "__UPDATED_AT__",

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

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

$meta.updatedAt is hard-coded to a fixed timestamp in the template, which will quickly become stale/misleading for regenerated configs. Consider making it a placeholder and populating it at hydration/activation time (or otherwise deriving it automatically) so the metadata reflects when the config was actually produced/updated.

Suggested change
"updatedAt": "2026-04-04T00:00:00.000Z",
"updatedAt": "__UPDATED_AT__",

Copilot uses AI. Check for mistakes.
"source": "configure"
},
"database": {
"mode": "__DATABASE_MODE__",
"connectionString": "__DATABASE_CONNECTION_STRING__"
},
"logging": {
"mode": "file"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Setting logging.mode to file may conflict with the systemd service configuration in home-manager/modules/paperclip/default.nix, which redirects StandardOutput and StandardError to a log file. If the application logs to its own file, it might bypass the systemd log capture or cause duplication. Consider using a mode that logs to stdout (e.g., console) to allow systemd to manage logs centrally via the journal or the configured redirection.

},
"server": {
"deploymentMode": "__DEPLOYMENT_MODE__",
"exposure": "private",
"host": "__HOST__",
"port": 3100
"port": 3100,
"allowedHostnames": [
"__ALLOWED_HOSTNAME__"
]
}
}
2 changes: 2 additions & 0 deletions config/paperclip/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ let
database_mode = if host.isKyber then "postgres" else "embedded-postgres";
database_connection_string =
if host.isKyber then "postgres://postgres:postgres@localhost:5432/paperclip" else "";
deployment_mode = if host.isKyber then "authenticated" else "local_trusted";
host = if host.isKyber then "0.0.0.0" else "127.0.0.1";
allowed_hostname = if host.isKyber then "paperclip.shunkakinoki.com" else "";
is_kyber = if host.isKyber then "true" else "false";
};
in
Expand Down
2 changes: 2 additions & 0 deletions config/paperclip/hydrate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ mkdir -p "${INSTANCE_DIR}"
@sed@ \
-e "s|__DATABASE_MODE__|@database_mode@|g" \
-e "s|__DATABASE_CONNECTION_STRING__|@database_connection_string@|g" \
-e "s|__DEPLOYMENT_MODE__|@deployment_mode@|g" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Add a substitution for the __UPDATED_AT__ placeholder to dynamically set the configuration's last updated timestamp using the current system time during deployment. This follows the established pattern for Nix-processed scripts in this repository.

Suggested change
-e "s|__DEPLOYMENT_MODE__|@deployment_mode@|g" \
-e "s|__DEPLOYMENT_MODE__|@deployment_mode@|g" \
-e "s|__UPDATED_AT__|$(date -u +'%Y-%m-%dT%H:%M:%S.000Z')|g" \
References
  1. Maintain consistency with established patterns for writing scripts that are extracted from Nix expressions, such as using @variable@ placeholders for build-time or deployment-time substitutions.

-e "s|__HOST__|@host@|g" \
-e "s|__ALLOWED_HOSTNAME__|@allowed_hostname@|g" \
"$TEMPLATE" >"$CONFIG"
Comment on lines 10 to 16

Copilot AI Apr 4, 2026

Copy link

Choose a reason for hiding this comment

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

A new __DEPLOYMENT_MODE__ substitution was added, but the existing ShellSpec coverage for this hydrate script doesn't assert that placeholder/substitution is present. Please extend spec/paperclip_hydrate_spec.sh to cover the new deployment mode substitution so regressions get caught.

Copilot uses AI. Check for mistakes.
chmod 600 "$CONFIG"

Expand Down
1 change: 0 additions & 1 deletion home-manager/modules/paperclip/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ lib.mkIf host.isKyber {
"HOME=${homeDir}"
"PATH=${homeDir}/.local/bin:${homeDir}/.bun/bin:${homeDir}/.nix-profile/bin:${homeDir}/.local/share/pnpm:${homeDir}/.local/share/fnm/current/bin:${homeDir}/.npm-global/bin:/usr/local/bin:/usr/bin:/bin"
];
EnvironmentFile = "${instanceDir}/.env";
WorkingDirectory = "${homeDir}/.paperclip";
StandardOutput = "append:/tmp/paperclip/paperclip.log";
StandardError = "append:/tmp/paperclip/paperclip.log";
Expand Down
Loading