-
Notifications
You must be signed in to change notification settings - Fork 11
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
Showing
25 changed files
with
838 additions
and
74 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
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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
version: "2" | ||
services: | ||
mysql: | ||
image: ${NANODEP_MYSQL_IMAGE:-mysql:5.7} | ||
platform: ${NANODEP_MYSQL_PLATFORM:-linux/x86_64} | ||
command: | ||
[ | ||
"mysqld", | ||
"--datadir=/tmp/mysqldata", | ||
"--log-bin=bin.log", | ||
"--server-id=master-01" | ||
] | ||
environment: | ||
MYSQL_ROOT_PASSWORD: toor | ||
MYSQL_DATABASE: nanodep | ||
MYSQL_USER: nanodep | ||
MYSQL_PASSWORD: insecure | ||
tmpfs: | ||
- /var/lib/mysql:rw,noexec,nosuid | ||
- /tmpfs | ||
ports: | ||
- "4242:3306" |
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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package parse | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/micromdm/nanodep/storage" | ||
"github.com/micromdm/nanodep/storage/file" | ||
"github.com/micromdm/nanodep/storage/mysql" | ||
) | ||
|
||
// Storage parses a storage name and dsn to determine which and return a storage backend. | ||
func Storage(storageName, dsn string) (storage.AllStorage, error) { | ||
var store storage.AllStorage | ||
var err error | ||
switch storageName { | ||
case "file": | ||
if dsn == "" { | ||
dsn = "db" | ||
} | ||
store, err = file.New(dsn) | ||
case "mysql": | ||
store, err = mysql.New(mysql.WithDSN(dsn)) | ||
default: | ||
return nil, fmt.Errorf("unknown storage: %q", storageName) | ||
} | ||
return store, err | ||
} |
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package file | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/micromdm/nanodep/storage" | ||
"github.com/micromdm/nanodep/storage/storagetest" | ||
) | ||
|
||
func TestFileStorage(t *testing.T) { | ||
storagetest.Run(t, func(t *testing.T) storage.AllStorage { | ||
s, err := New(t.TempDir()) | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
return s | ||
}) | ||
} |
Oops, something went wrong.