Skip to content

Commit f9d56fe

Browse files
committed
Fix for configuration not being mountable.
1 parent f0314c7 commit f9d56fe

10 files changed

Lines changed: 16 additions & 22 deletions

File tree

ES.SFTP.Host/Business/Configuration/GlobalConfiguration.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace ES.SFTP.Host.Business.Configuration
44
{
55
public class GlobalConfiguration
66
{
7-
public string HomeDirectory { get; set; }
87
public ChrootDefinition Chroot { get; set; }
98
public List<string> Directories { get; set; } = new List<string>();
109
}

ES.SFTP.Host/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static IHostBuilder CreateHostBuilder(string[] args)
4848
.ConfigureAppConfiguration((hostingContext, config) =>
4949
{
5050
config.AddJsonFile("app.logging.json", false, false);
51-
config.AddJsonFile("sftp.json", false, true);
51+
config.AddJsonFile("config/sftp.json", false, true);
5252
config.AddEnvironmentVariables(EnvironmentVariablePrefix);
5353
config.AddCommandLine(args);
5454
})

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Process:
2929

3030
### Configuration
3131

32-
The SFTP server uses a `json` based configuration file for default server options and to define users. This file has to be mounted on `/app/sftp.json` inside the container.
32+
The SFTP server uses a `json` based configuration file for default server options and to define users. This file has to be mounted on `/app/config/sftp.json` inside the container.
3333
Environment variable based configuration is not supported (see the `Advanced Configuration` section below for the reasons).
3434

3535
Below is the simplest configuration file for the SFTP server:
@@ -70,14 +70,14 @@ This will start a SFTP in the container `sftp` with the default configuration. Y
7070
> Provide your configuration
7171
7272
```shellsession
73-
$ docker run -p 22:22 -d emberstack/sftp --name sftp -v /host/sftp.json:/app/sftp.json:ro
73+
$ docker run -p 22:22 -d emberstack/sftp --name sftp -v /host/sftp.json:/app/config/sftp.json:ro
7474
```
75-
This will override the default (`/app/sftp.json`) configuration with the one from the host `/host/sftp.json`.
75+
This will override the default (`/app/config/sftp.json`) configuration with the one from the host `/host/sftp.json`.
7676

7777
> Mount a directory from the host for the user 'demo'
7878
7979
```shellsession
80-
$ docker run -p 22:22 -d emberstack/sftp --name sftp -v /host/sftp.json:/app/sftp.json:ro -v /host/demo:/home/demo/sftp
80+
$ docker run -p 22:22 -d emberstack/sftp --name sftp -v /host/sftp.json:/app/config/sftp.json:ro -v /host/demo:/home/demo/sftp
8181
```
8282
This will mount the `demo` directory from the host on the `sftp` directory for the "demo" user.
8383

@@ -95,7 +95,7 @@ services:
9595
ports:
9696
- "22:22"
9797
volumes:
98-
- ../config-samples/sample.sftp.json:/app/sftp.json:ro
98+
- ../config-samples/sample.sftp.json:/app/config/sftp.json:ro
9999
```
100100
And run it using docker-compose
101101
```shellsession
@@ -126,6 +126,7 @@ You can customize the values of the helm deployment by using the following Value
126126
| `image.pullPolicy` | Container image pull policy | `Always` if `image.tag` is `latest`, else `IfNotPresent`|
127127
| `storage.volumes` | Defines additional volumes for the pod | `{}` |
128128
| `storage.volumeMounts` | Defines additional volumes mounts for the sftp container | `{}` |
129+
| `configuration` | Allows the in-line override of the configuration values | `null` |
129130
| `configuration.Global.Chroot.Directory` | Global chroot directory for the `sftp` user group. Can be overriden per-user | `"%h"` |
130131
| `configuration.Global.Chroot.StartPath` | Start path for the `sftp` user group. Can be overriden per-user | `"sftp"` |
131132
| `configuration.Global.Directories` | Directories that get created for all `sftp` users. Can be appended per user | `["sftp"]` |

deploy/docker-compose/docker-compose.override.dev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ services:
88
ports:
99
- "2222:22"
1010
volumes:
11-
- ../samples/sample.dev.sftp.json:/app/sftp.json:ro
11+
- ../samples/sample.dev.sftp.json:/app/config/sftp.json:ro
1212
- ../samples/.ssh/id_demo_rsa.pub:/home/demo/.ssh/keys/id_rsa.pub:ro
1313
- ../samples/.ssh/id_demo2_rsa.pub:/home/demo2/.ssh/keys/id_rsa.pub:ro

deploy/docker-compose/docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ services:
55
ports:
66
- "22:22"
77
volumes:
8-
- ../samples/sample.sftp.json:/app/sftp.json:ro
8+
- ../samples/sample.sftp.json:/app/config/sftp.json:ro

deploy/helm/sftp/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ You can customize the values of the helm deployment by using the following Value
3333
| `image.pullPolicy` | Container image pull policy | `Always` if `image.tag` is `latest`, else `IfNotPresent`|
3434
| `storage.volumes` | Defines additional volumes for the pod | `{}` |
3535
| `storage.volumeMounts` | Defines additional volumes mounts for the sftp container | `{}` |
36+
| `configuration` | Allows the in-line override of the configuration values | `null` |
3637
| `configuration.Global.Chroot.Directory` | Global chroot directory for the `sftp` user group. Can be overriden per-user | `"%h"` |
3738
| `configuration.Global.Chroot.StartPath` | Start path for the `sftp` user group. Can be overriden per-user | `"sftp"` |
3839
| `configuration.Global.Directories` | Directories that get created for all `sftp` users. Can be appended per user | `["sftp"]` |

deploy/helm/sftp/templates/deployment.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ spec:
3636
volumeMounts:
3737
{{- if .Values.configuration }}
3838
- name: sftp-json
39-
mountPath: "/app"
39+
mountPath: "/app/config"
40+
subPath: sftp.json
4041
readOnly: true
4142
{{- end }}
4243
{{- with .Values.storage.volumeMounts }}

deploy/helm/sftp/values.yaml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,14 @@ nameOverride: ""
1414
fullnameOverride: ""
1515

1616

17-
configuration:
18-
Global:
19-
Chroot:
20-
Directory: "%h"
21-
StartPath: "sftp"
22-
Directories: ["sftp"]
23-
Users:
24-
- Username: demo
25-
Password: demo
17+
configuration: null
2618

2719
storage:
28-
volumeMounts: {}
29-
volumes: {}
20+
volumeMounts: []
21+
volumes: []
3022

3123

32-
initContainers: {}
24+
initContainers: []
3325

3426
service:
3527
type: ClusterIP

0 commit comments

Comments
 (0)