mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Pinecone standalone refactoring (#2685)
This refactors the `dendrite-demo-pinecone` executable so that it: 1. Converts the old `.key` file into a standard `.pem` file 2. Allows passing in the `--config` option to supply a normal Dendrite configuration file, so that you can configure PostgreSQL instead of SQLite, appservices and all the other usual stuff
This commit is contained in:
parent
02ec00b1bb
commit
ba0b3adab4
3 changed files with 86 additions and 46 deletions
|
@ -224,12 +224,7 @@ func loadConfig(
|
|||
}
|
||||
|
||||
privateKeyPath := absPath(basePath, c.Global.PrivateKeyPath)
|
||||
privateKeyData, err := readFile(privateKeyPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if c.Global.KeyID, c.Global.PrivateKey, err = readKeyPEM(privateKeyPath, privateKeyData, true); err != nil {
|
||||
if c.Global.KeyID, c.Global.PrivateKey, err = LoadMatrixKey(privateKeyPath, readFile); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
@ -265,6 +260,14 @@ func loadConfig(
|
|||
return &c, nil
|
||||
}
|
||||
|
||||
func LoadMatrixKey(privateKeyPath string, readFile func(string) ([]byte, error)) (gomatrixserverlib.KeyID, ed25519.PrivateKey, error) {
|
||||
privateKeyData, err := readFile(privateKeyPath)
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
return readKeyPEM(privateKeyPath, privateKeyData, true)
|
||||
}
|
||||
|
||||
// Derive generates data that is derived from various values provided in
|
||||
// the config file.
|
||||
func (config *Dendrite) Derive() error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue