forked from Plemya-x/ALR
		
	alr изменения
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -24,8 +24,8 @@ import (
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"github.com/pelletier/go-toml/v2"
 | 
			
		||||
	"lure.sh/lure/internal/types"
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/internal/types"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var defaultConfig = &types.Config{
 | 
			
		||||
@@ -35,7 +35,7 @@ var defaultConfig = &types.Config{
 | 
			
		||||
	Repos: []types.Repo{
 | 
			
		||||
		{
 | 
			
		||||
			Name: "default",
 | 
			
		||||
			URL:  "https://github.com/lure-sh/lure-repo.git",
 | 
			
		||||
			URL:  "https://gitflic.ru/project/xpamych/xpamych-alr-repo.git",
 | 
			
		||||
		},
 | 
			
		||||
	},
 | 
			
		||||
}
 | 
			
		||||
@@ -45,7 +45,7 @@ var (
 | 
			
		||||
	config    *types.Config
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Config returns a LURE configuration struct.
 | 
			
		||||
// Config returns a ALR configuration struct.
 | 
			
		||||
// The first time it's called, it'll load the config from a file.
 | 
			
		||||
// Subsequent calls will just return the same value.
 | 
			
		||||
func Config(ctx context.Context) *types.Config {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -24,7 +24,7 @@ import (
 | 
			
		||||
	"strings"
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
	"golang.org/x/text/language"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
/*
 | 
			
		||||
 * LURE - Linux User REpository
 | 
			
		||||
 * Copyright (C) 2023 Elara Musayelyan
 | 
			
		||||
 * ALR - Any Linux Repository
 | 
			
		||||
 * Copyright (C) 2024 Евгений Храмов
 | 
			
		||||
 *
 | 
			
		||||
 * This program is free software: you can redistribute it and/or modify
 | 
			
		||||
 * it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -25,10 +25,10 @@ import (
 | 
			
		||||
	"sync"
 | 
			
		||||
 | 
			
		||||
	"github.com/pelletier/go-toml/v2"
 | 
			
		||||
	"lure.sh/lure/pkg/loggerctx"
 | 
			
		||||
	"plemya-x.ru/alr/pkg/loggerctx"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// Paths contains various paths used by LURE
 | 
			
		||||
// Paths contains various paths used by ALR
 | 
			
		||||
type Paths struct {
 | 
			
		||||
	ConfigDir  string
 | 
			
		||||
	ConfigPath string
 | 
			
		||||
@@ -60,19 +60,19 @@ func GetPaths(ctx context.Context) *Paths {
 | 
			
		||||
			log.Fatal("Unable to detect user config directory").Err(err).Send()
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		paths.ConfigDir = filepath.Join(cfgDir, "lure")
 | 
			
		||||
		paths.ConfigDir = filepath.Join(cfgDir, "alr")
 | 
			
		||||
 | 
			
		||||
		err = os.MkdirAll(paths.ConfigDir, 0o755)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Fatal("Unable to create LURE config directory").Err(err).Send()
 | 
			
		||||
			log.Fatal("Unable to create ALR config directory").Err(err).Send()
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		paths.ConfigPath = filepath.Join(paths.ConfigDir, "lure.toml")
 | 
			
		||||
		paths.ConfigPath = filepath.Join(paths.ConfigDir, "alr.toml")
 | 
			
		||||
 | 
			
		||||
		if _, err := os.Stat(paths.ConfigPath); err != nil {
 | 
			
		||||
			cfgFl, err := os.Create(paths.ConfigPath)
 | 
			
		||||
			if err != nil {
 | 
			
		||||
				log.Fatal("Unable to create LURE config file").Err(err).Send()
 | 
			
		||||
				log.Fatal("Unable to create ALR config file").Err(err).Send()
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			err = toml.NewEncoder(cfgFl).Encode(&defaultConfig)
 | 
			
		||||
@@ -88,7 +88,7 @@ func GetPaths(ctx context.Context) *Paths {
 | 
			
		||||
			log.Fatal("Unable to detect cache directory").Err(err).Send()
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		paths.CacheDir = filepath.Join(cacheDir, "lure")
 | 
			
		||||
		paths.CacheDir = filepath.Join(cacheDir, "alr")
 | 
			
		||||
		paths.RepoDir = filepath.Join(paths.CacheDir, "repo")
 | 
			
		||||
		paths.PkgsDir = filepath.Join(paths.CacheDir, "pkgs")
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
package config
 | 
			
		||||
 | 
			
		||||
// Version contains the version of LURE. If the version
 | 
			
		||||
// Version contains the version of ALR. If the version
 | 
			
		||||
// isn't known, it'll be set to "unknown"
 | 
			
		||||
var Version = "unknown"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user