mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-07-23 12:51:40 +02:00
use token from cluster.json
This commit is contained in:
@@ -6,9 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/ClusterCockpit/cc-jobarchive/config"
|
||||
@@ -46,13 +44,9 @@ type ApiStatsData struct {
|
||||
Max schema.Float `json:"max"`
|
||||
}
|
||||
|
||||
func (ccms *CCMetricStore) Init(url string) error {
|
||||
ccms.url = url // os.Getenv("CCMETRICSTORE_URL")
|
||||
ccms.jwt = os.Getenv("CCMETRICSTORE_JWT")
|
||||
if ccms.jwt == "" {
|
||||
log.Println("warning: environment variable 'CCMETRICSTORE_JWT' not set")
|
||||
}
|
||||
|
||||
func (ccms *CCMetricStore) Init(url, token string) error {
|
||||
ccms.url = url
|
||||
ccms.jwt = token
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,7 @@ import (
|
||||
type MetricDataRepository interface {
|
||||
// Initialize this MetricDataRepository. One instance of
|
||||
// this interface will only ever be responsible for one cluster.
|
||||
Init(url string) error
|
||||
Init(url, token string) error
|
||||
|
||||
// Return the JobData for the given job, only with the requested metrics.
|
||||
LoadData(job *schema.Job, metrics []string, ctx context.Context) (schema.JobData, error)
|
||||
@@ -37,7 +37,7 @@ func Init(jobArchivePath string, disableArchive bool) error {
|
||||
switch cluster.MetricDataRepository.Kind {
|
||||
case "cc-metric-store":
|
||||
ccms := &CCMetricStore{}
|
||||
if err := ccms.Init(cluster.MetricDataRepository.Url); err != nil {
|
||||
if err := ccms.Init(cluster.MetricDataRepository.Url, cluster.MetricDataRepository.Token); err != nil {
|
||||
return err
|
||||
}
|
||||
metricDataRepos[cluster.Name] = ccms
|
||||
|
Reference in New Issue
Block a user