Skip to content
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
37 changes: 16 additions & 21 deletions config/CMCONF_EXAMPLEConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,34 +1,26 @@
#
# Example configuration for CMCONF system.
# Example configuration.
#

FIND_PACKAGE(CMLIB REQUIRED COMPONENTS CMCONF)

CMCONF_INIT_SYSTEM(EXAMPLE)

#
# Setting using upstream Package Repository by default for this system. This can be overridden by
# App in CMakeLists.txt.
# It can be used to statically define local Package Repository.
# Not only by BA_PACKAGE_LOCAL_PATH ENV variable.
#
CMCONF_SET(BA_PACKAGE_LOCAL_USE OFF)
CMCONF_SET(BA_PACKAGE_LOCAL_PATH "")
CMCONF_SET(BA_PACKAGE_LOCAL_PATH "<path_to_local_repo>")

#
# The http authorization header is usually used for accessing private Package Repositories. This
# example does not need it, but the variable must be set.
# It works for a publicly accessible repository.
#
CMCONF_SET(BA_PACKAGE_HTTP_AUTHORIZATION_HEADER "")

#
# Authorization header can be set from ENV variable
#
#CMCONF_SET(BA_PACKAGE_HTTP_AUTHORIZATION_HEADER "$ENV{ACCESS_TOKEN_ROCKS}")

#
# Setting BringAuto's Package Repository URI Template
#
CMCONF_SET(BA_PACKAGE_URI_REVISION master)
CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.example.com/my-project/package-repository/media/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")
CMCONF_SET(BA_PACKAGE_GIT_ARCHIVE_PATH_TEMPLATE "")
CMCONF_SET(BA_PACKAGE_HTTP_HEADER "")
CMCONF_SET(BA_PACKAGE_TEMPLATE_ARGS_URI_ESCAPE OFF)
CMCONF_SET(BA_PACKAGE_URI_REVISION main)
CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.example.com/username/repository/media/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")

#
# Gitea hosted public Package Repository:
Expand All @@ -39,11 +31,14 @@ CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.example.com/my-project/
# Gitea hosted private Package Repository.
# Do not forget to specify Access Token
#
#CMCONF_SET(BA_PACKAGE_HTTP_AUTHORIZATION_HEADER "token <token>")
#CMCONF_SET(BA_PACKAGE_HTTP_HEADER "Authorization: token <token>")
#CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.example.com/username/repository/raw/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")
Comment on lines +34 to 35
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent token reference: literal <token> vs $ENV{...} in the GitLab example (line 43).

The Gitea private example at line 34 uses a literal <token> placeholder, while the GitLab example at line 43 uses $ENV{GITLAB_TOKEN}. Even in example comments, guiding users toward env-variable references is safer — it reduces the risk of someone copying the pattern and hardcoding a credential.

🔒 Suggested adjustment for consistency
-#CMCONF_SET(BA_PACKAGE_HTTP_HEADER "Authorization: token <token>")
+#CMCONF_SET(BA_PACKAGE_HTTP_HEADER "Authorization: token $ENV{GITEA_TOKEN}")
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#CMCONF_SET(BA_PACKAGE_HTTP_HEADER "Authorization: token <token>")
#CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.example.com/username/repository/raw/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")
`#CMCONF_SET`(BA_PACKAGE_HTTP_HEADER "Authorization: token $ENV{GITEA_TOKEN}")
`#CMCONF_SET`(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitea.example.com/username/repository/raw/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@config/CMCONF_EXAMPLEConfig.cmake` around lines 34 - 35, The
BA_PACKAGE_HTTP_HEADER example uses a literal "<token>" while
BA_PACKAGE_URI_TEMPLATE_REMOTE uses $ENV{GITLAB_TOKEN}; update the Gitea example
to reference an environment variable instead of a hardcoded token (e.g., change
BA_PACKAGE_HTTP_HEADER "Authorization: token <token>" to use $ENV{...}) so both
examples consistently show using env vars; modify the BA_PACKAGE_HTTP_HEADER
example and any neighboring comments to demonstrate $ENV{GITEA_TOKEN} (or
similar) and keep BA_PACKAGE_URI_TEMPLATE_REMOTE unchanged aside from matching
variable naming.


#
# Gitlab hosted private Package Repository.
# gitlab_project_id is the id of the project in Gitlab. It can be found in General setting page of the project
#
#CMCONF_SET(BA_PACKAGE_HTTP_AUTHORIZATION_HEADER "Bearer <token>")
#CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitlab.example.com/username/repository/-/raw/<REVISION>/package/<GIT_PATH>/<PACKAGE_GROUP_NAME>/<ARCHIVE_NAME>")
#SET(gitlab_project_id 000)
#CMCONF_SET(BA_PACKAGE_TEMPLATE_ARGS_URI_ESCAPE ON)
#CMCONF_SET(BA_PACKAGE_HTTP_HEADER "PRIVATE-TOKEN: $ENV{GITLAB_TOKEN}")
#CMCONF_SET(BA_PACKAGE_URI_TEMPLATE_REMOTE "https://gitlab.example.com/api/v4/projects/${gitlab_project_id}/repository/files/package%2F<GIT_PATH>%2F<PACKAGE_GROUP_NAME>%2F<ARCHIVE_NAME>/raw?ref=<REVISION>&lfs=true")