From eb3e07a86543fde40f877b988d6357294b13fda6 Mon Sep 17 00:00:00 2001 From: Lorenzo Cappelletti Date: Mon, 19 Jan 2026 14:42:12 +0100 Subject: [PATCH] Use XDG_CONFIG_HOME as base path --- README.md | 8 ++++---- gitlab_artifact_cleanup/config.py | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 98e044b..1a04bd4 100644 --- a/README.md +++ b/README.md @@ -59,10 +59,10 @@ Run gitlab-artifact-cleanup --write-default-config ``` -to create an initial configuration file at `~/.gitlab-artifact-cleanuprc`. Then, open the web page of your GitLab -instance and navigate to *User Settings* -> *Access Tokens*. Create a new token with the `api` scope and copy its -contents into the newly created configuration file (`access_token`) and set the `url` of your GitLab server if you are -not using `gitlab.com`. +to create an initial configuration file at `${XDG_CONFIG_HOME}/gitlab-artifact-cleanup/config.ini`. Then, open the web +page of your GitLab instance and navigate to *User Settings* -> *Access Tokens*. Create a new token with the `api` scope +and copy its contents into the newly created configuration file (`access_token`) and set the `url` of your GitLab server +if you are not using `gitlab.com`. Now, run diff --git a/gitlab_artifact_cleanup/config.py b/gitlab_artifact_cleanup/config.py index 11cf549..78015ef 100644 --- a/gitlab_artifact_cleanup/config.py +++ b/gitlab_artifact_cleanup/config.py @@ -5,7 +5,10 @@ from enum import Enum, auto from typing import Any, Optional, TextIO, Union, cast -CONFIG_FILEPATH = "~/.gitlab-artifact-cleanuprc" +CONFIG_FILEPATH = os.path.join( + os.environ.get('XDG_CONFIG_HOME') or os.path.expanduser('~/.config'), + "gitlab-artifact-cleanup", + "config.ini") class UnknownAlwaysKeepError(Exception):