Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plausible Analytics: Support for Google Cloud Integration #364065

Open
wants to merge 1 commit into
base: nixos-24.05
Choose a base branch
from
Open
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
29 changes: 28 additions & 1 deletion nixos/modules/services/web-apps/plausible.nix
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,27 @@ in {
};
};
};

googleOAuth = {
clientId = mkOption {
default = null;
type = types.str;
description = ''
The GOOGLE_CLIENT_ID from Google Cloud OAuth, as seen in
https://github.com/plausible/community-edition/wiki/google-integration
'';
};

clientSecretFile = mkOption {
default = null;
type = types.str;
description = ''
The path to a file containing the GOOGLE_CLIENT_SECRET from Google
Cloud OAuth, as seen in
https://github.com/plausible/community-edition/wiki/google-integration
'';
};
};
};

imports = [
Expand Down Expand Up @@ -261,6 +282,8 @@ in {
SELFHOST = "true";
} // (optionalAttrs (cfg.mail.smtp.user != null) {
SMTP_USER_NAME = cfg.mail.smtp.user;
}) // (optionalAttrs (cfg.googleOAuth.clientId != null) {
GOOGLE_CLIENT_ID = cfg.googleOAuth.clientId;
});

path = [ cfg.package ]
Expand All @@ -276,6 +299,9 @@ in {
${lib.optionalString (cfg.mail.smtp.passwordFile != null)
''export SMTP_USER_PWD="$(< $CREDENTIALS_DIRECTORY/SMTP_USER_PWD )"''}

${lib.optionalString (cfg.googleOAuth.clientSecretFile != null)
''export GOOGLE_CLIENT_SECRET="$(< $CREDENTIALS_DIRECTORY/GOOGLE_CLIENT_SECRET )"''}

${lib.optionalString cfg.database.postgres.setup ''
# setup
${cfg.package}/createdb.sh
Expand All @@ -299,7 +325,8 @@ in {
LoadCredential = [
"ADMIN_USER_PWD:${cfg.adminUser.passwordFile}"
"SECRET_KEY_BASE:${cfg.server.secretKeybaseFile}"
] ++ lib.optionals (cfg.mail.smtp.passwordFile != null) [ "SMTP_USER_PWD:${cfg.mail.smtp.passwordFile}"];
] ++ lib.optionals (cfg.mail.smtp.passwordFile != null) [ "SMTP_USER_PWD:${cfg.mail.smtp.passwordFile}"]
++ lib.optionals (cfg.googleOAuth.clientSecretFile != null) [ "GOOGLE_CLIENT_SECRET:${cfg.googleOAuth.clientSecretFile}" ];
};
};
}
Expand Down
Loading