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

Config Download #540

Merged
merged 19 commits into from
Jan 18, 2024
Merged

Config Download #540

merged 19 commits into from
Jan 18, 2024

Conversation

aphralG
Copy link
Contributor

@aphralG aphralG commented Jan 16, 2024

Proposed changes

Added:

  • Download File using GetFilesMetaData() & GetFile()
  • Cache to be used to check if file needs to be downloaded or is current version on disk the latest

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@aphralG aphralG self-assigned this Jan 16, 2024
@github-actions github-actions bot added the chore Pull requests for routine tasks label Jan 16, 2024
api/grpc/instances/file.proto Show resolved Hide resolved
internal/datasource/os/files_test.go Outdated Show resolved Hide resolved
internal/client/http_config_client.go Outdated Show resolved Hide resolved
internal/datasource/os/files.go Outdated Show resolved Hide resolved
aphralG and others added 3 commits January 17, 2024 15:15
Co-authored-by: Olli Holmala <85518764+olli-holmala@users.noreply.github.com>

func NewHttpConfigClient() *HttpConfigClient {
httpClient := http.Client{
Timeout: time.Second * 10,
Copy link
Contributor

Choose a reason for hiding this comment

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

can you move this to a config setting?

files := instances.Files{}

req, err := http.NewRequest(http.MethodGet, filesUrl, nil)
req.Header.Set("tenantId", tenantID.String())
Copy link
Contributor

Choose a reason for hiding this comment

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

tenantId is probably better as a constant

@@ -0,0 +1,83 @@
package datasource
Copy link
Contributor

Choose a reason for hiding this comment

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

copywrite header missing

)

// map of files with filepath as key
type FileCache = map[string]*instances.File
Copy link
Contributor

Choose a reason for hiding this comment

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

should this type be visible outside of this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes as its needed in config writer


ConfigWriterParameters struct {
configDownloader client.HttpConfigClientInterface
client Client
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
client Client
Client Client

@aphralG aphralG merged commit ef07d67 into v3 Jan 18, 2024
2 checks passed
@aphralG aphralG deleted the config-download branch January 18, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants