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

Script to update the timezone in specified AGiXT Docker Compose files to the current server timezone. #1106

Merged
merged 3 commits into from
Feb 16, 2024

Conversation

AliveDedSec
Copy link
Contributor

@AliveDedSec AliveDedSec commented Feb 4, 2024

Explanation of the script:

Determine Current Timezone:

Use timedatectl to retrieve information about the current server timezone.

awk extracts the timezone information from the output.

Function to Replace Timezone:

Define a function replace_timezone that takes a file as an argument and uses sed to replace the timezone pattern in the file.

The pattern TZ=${TZ-[^}]*} matches strings like TZ=${TZ-America/New_York} or similar.

Array of Files:

Create an array compose_files containing the names of Docker Compose files to be updated.

Update Each File:

Iterate through the array of files and call the replace_timezone function for each file.

Display Success Message:

Print a message indicating that the timezone in the files has been successfully updated to the current server timezone.

This script ensures that the timezone pattern in the specified Docker Compose files is replaced with the current server timezone.

Description

Motivation and Context

How has this been tested?

Screenshots (if appropriate)

Types of changes

Changes visible to users:

  • Bug fix (prefix: fix - non-breaking change which fixes an issue)
  • New feature (prefix: feat - non-breaking change which adds functionality)
  • Breaking change (prefix: feat!! or fix!! - fix or feature that would cause existing functionality to not work as expected)

Internal changes:

  • Refactor (prefix: refactor - non-breaking change which only improves the design or structure of existing code, and making no changes to its external behaviour)
  • Tests (prefix: test - additions and improvements to unit tests and the smoke tests)
  • Infrastructure (prefix: chore - examples include GitHub Actions, issue templates)

Checklist

  • My code follows the code style of this project and passes yarn run lint.
  • My change requires a change to the documentation.
  • My change works!

AliveDedSec and others added 3 commits February 4, 2024 21:30
Script to update the timezone in specified AGiXT Docker Compose files to the current server timezone.

# Explanation of the script:

# Determine Current Timezone:
# Use timedatectl to retrieve information about the current server timezone.
# awk extracts the timezone information from the output.

# Function to Replace Timezone:
# Define a function replace_timezone that takes a file as an argument and uses sed to replace the timezone pattern in the file.
# The pattern TZ=${TZ-[^}]*} matches strings like TZ=${TZ-America/New_York} or similar.

# Array of Files:
# Create an array compose_files containing the names of Docker Compose files to be updated.

# Update Each File:
# Iterate through the array of files and call the replace_timezone function for each file.

# Display Success Message:
# Print a message indicating that the timezone in the files has been successfully updated to the current server timezone.

# This script ensures that the timezone pattern in the specified Docker Compose files is replaced with the current server timezone.


Signed-off-by: pegas07770 <142100707+pegas07770@users.noreply.github.com>
@Josh-XT Josh-XT merged commit 1ed2122 into Josh-XT:main Feb 16, 2024
@Josh-XT
Copy link
Owner

Josh-XT commented Feb 16, 2024

Hello. You can alternatively use the TZ environment variable in the .env file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants