Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
acmeserver
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ai3
tools
acmeserver
Commits
63efefed
Commit
63efefed
authored
1 year ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Implement a filesystem storage backend
Fixes
#8
.
parent
3f268ee3
No related branches found
No related tags found
1 merge request
!34
V3
Pipeline
#57374
failed
1 year ago
Stage: test
Stage: build
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmd/acmeserver/acmeserver.go
+2
-0
2 additions, 0 deletions
cmd/acmeserver/acmeserver.go
upload/config.go
+40
-2
40 additions, 2 deletions
upload/config.go
upload/replds.go
+2
-2
2 additions, 2 deletions
upload/replds.go
with
44 additions
and
4 deletions
cmd/acmeserver/acmeserver.go
+
2
−
0
View file @
63efefed
...
...
@@ -58,6 +58,8 @@ func defaultConfig() *Config {
config
.
ACME
.
HTTP
.
Enabled
=
true
config
.
ACME
.
AccountKeyPath
=
"/var/lib/acme/account.key"
config
.
ACME
.
KeyType
=
common
.
KeyTypeECDSA
config
.
Output
.
Type
=
"file"
config
.
Output
.
FS
.
Path
=
"/var/lib/acme/certs"
return
&
config
}
...
...
This diff is collapsed.
Click to expand it.
upload/config.go
+
40
−
2
View file @
63efefed
package
upload
// Config for the output storage layer.
type
Config
struct
{
import
(
"context"
"fmt"
"git.autistici.org/ai3/tools/acmeserver/common"
)
type
ReplDSConfig
struct
{
Endpoint
string
`yaml:"endpoint"`
Prefix
string
`yaml:"prefix"`
TLS
struct
{
...
...
@@ -10,3 +16,35 @@ type Config struct {
CA
string
`yaml:"ca"`
}
`yaml:"tls"`
}
type
FSConfig
struct
{
Path
string
`yaml:"path"`
}
const
(
configTypeFS
=
"file"
configTypeReplDS
=
"replds"
)
// Config for the output storage layer.
type
Config
struct
{
Type
string
`yaml:"type"`
ReplDS
ReplDSConfig
`yaml:"replds"`
FS
FSConfig
`yaml:"file"`
}
// Uploader is the interface to the storage backend.
type
Uploader
interface
{
Upload
(
context
.
Context
,
string
,
*
common
.
Credentials
)
error
}
func
New
(
config
*
Config
)
(
Uploader
,
error
)
{
switch
config
.
Type
{
case
configTypeFS
:
return
newFS
(
&
config
.
FS
)
case
configTypeReplDS
:
return
newReplDS
(
&
config
.
ReplDS
)
default
:
return
nil
,
fmt
.
Errorf
(
"unknown storage type '%s'"
,
config
.
Type
)
}
}
This diff is collapsed.
Click to expand it.
upload/replds.go
+
2
−
2
View file @
63efefed
...
...
@@ -40,8 +40,8 @@ type ReplStorage struct {
conn
*
grpc
.
ClientConn
}
//
N
ew creates a new ReplStorage.
func
N
ew
(
config
*
Config
)
(
*
ReplStorage
,
error
)
{
//
n
ew
ReplDS
creates a new ReplStorage.
func
n
ew
ReplDS
(
config
*
ReplDS
Config
)
(
*
ReplStorage
,
error
)
{
var
creds
credentials
.
TransportCredentials
if
config
.
TLS
.
Cert
!=
""
&&
config
.
TLS
.
Key
!=
""
&&
config
.
TLS
.
CA
!=
""
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment