-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2f3acf
commit e61c083
Showing
23 changed files
with
289 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
DATABASE_URL="sqlite://:memory:" | ||
DATABASE_URL="sqlite:///path/to/feedbox.db" | ||
HOST="0.0.0.0" | ||
PORT=8000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,33 @@ | ||
package email | ||
|
||
import "context" | ||
import ( | ||
"context" | ||
"sync/atomic" | ||
) | ||
|
||
type Client interface { | ||
Send(ctx context.Context, addr string, subject string, text string) error | ||
} | ||
|
||
/// | ||
|
||
var defaultImpl atomic.Pointer[Client] | ||
|
||
func init() { | ||
var dryrun Client = NewDryRun() | ||
defaultImpl.Store(&dryrun) | ||
} | ||
|
||
func Default() Client { | ||
return *defaultImpl.Load() | ||
} | ||
|
||
func SetDefault(c Client) { | ||
defaultImpl.Store(&c) | ||
} | ||
|
||
/// | ||
|
||
func Send(ctx context.Context, addr string, subject string, text string) error { | ||
return Default().Send(ctx, addr, subject, text) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,49 @@ | ||
package sign | ||
|
||
import "sync/atomic" | ||
|
||
type Client interface { | ||
Encode(plaintext []byte) ([]byte, error) | ||
Decode(data []byte) ([]byte, error) | ||
DecodeFromHex(hexData string) ([]byte, error) | ||
EncodeToHex(plaintext []byte) (string, error) | ||
} | ||
|
||
/// | ||
|
||
var defaultImpl atomic.Pointer[Client] | ||
|
||
func init() { | ||
var dryrun Client | ||
dryrun, err := NewWithPassword("dryrun") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defaultImpl.Store(&dryrun) | ||
} | ||
|
||
func Default() Client { | ||
return *defaultImpl.Load() | ||
} | ||
|
||
func SetDefault(c Client) { | ||
defaultImpl.Store(&c) | ||
} | ||
|
||
/// | ||
|
||
func Encode(plaintext []byte) ([]byte, error) { | ||
return Default().Encode(plaintext) | ||
} | ||
|
||
func Decode(data []byte) ([]byte, error) { | ||
return Default().Decode(data) | ||
} | ||
|
||
func DecodeFromHex(hexData string) ([]byte, error) { | ||
return Default().DecodeFromHex(hexData) | ||
} | ||
|
||
func EncodeToHex(plaintext []byte) (string, error) { | ||
return Default().EncodeToHex(plaintext) | ||
} |
Oops, something went wrong.