sTywin / dyndns53

Implementation of dyndns2 dynamic DNS protocol for AWS Lambda, API Gateway, and Route 53
MIT License
66 stars 25 forks source link

Question - Multiple dyndns clients #6

Closed reelsense closed 7 years ago

reelsense commented 7 years ago

How do I add multiple dyndns clients? Every time I get one to pass testing the others seem to stop passing tests.

Below is the section in question from dyndns53.py


conf = {
'EXAMPLEUSER1:EXAMPLEPASS1': {
'hosts': {
'alpha.dyndns.example.com.': {
'aws_region': 'us-east-1',
'zone_id': 'ZONEID1234',
'record': {
'ttl': 60,
'type': 'A',
},
'last_update': None,
},
},
},
}

conf = { 'EXAMPLEUSER2:EXAMPLEPASS2': { 'hosts': { 'bravo.dyndns.example.com.': { 'aws_region': 'us-east-1', 'zone_id': 'ZONEID1234', 'record': { 'ttl': 60, 'type': 'A', }, 'last_update': None, }, }, }, }


### Or

conf = { 'EXAMPLEUSER1:EXAMPLEPASS1': { 'hosts': { 'alpha.dyndns.example.com.': { 'aws_region': 'us-east-1', 'zone_id': 'ZONEID1234', 'record': { 'ttl': 60, 'type': 'A', }, 'last_update': None, }, }, }, } { 'EXAMPLEUSER2:EXAMPLEPASS2': { 'hosts': { 'bravo.dyndns.example.com.': { 'aws_region': 'us-east-1', 'zone_id': 'ZONEID1234', 'record': { 'ttl': 60, 'type': 'A', }, 'last_update': None, }, }, }, }



Is there a limit?
sTywin commented 7 years ago

No, there is no limit. If you are not familiar with Python, I suggest you read through the documentation on dictionaries. conf is a Python dictionary, itself made up of other dictionaries. Are you familiar with JSON? It is very similar.

If you want to use a single username/password combination, you can have multiple domains under the hosts sub-dictionary:

conf = {
    'EXAMPLEUSER1:EXAMPLEPASS1': {
        'hosts': {
            'alpha.dyndns.example.com.': {
                'aws_region': 'us-east-1',
                'zone_id': 'ZONEID1234',
                'record': {
                    'ttl': 60,
                    'type': 'A',
                },
                'last_update': None,
            },
            'bravo.dyndns.example.com.': {
                'aws_region': 'us-east-1',
                'zone_id': 'ZONEID1234',
                'record': {
                    'ttl': 60,
                    'type': 'A',
                },
                'last_update': None,
            },
        },
    },
}

On the other hand, if you prefer (or require) multiple username/password combinations, you can also place multiple username/password combinations under the root conf dictionary:

conf = {
    'EXAMPLEUSER1:EXAMPLEPASS1': {
        'hosts': {
            'alpha.dyndns.example.com.': {
                'aws_region': 'us-east-1',
                'zone_id': 'ZONEID1234',
                'record': {
                    'ttl': 60,
                    'type': 'A',
                },
                'last_update': None,
            },
        },
    },
    'EXAMPLEUSER2:EXAMPLEPASS2': {
        'hosts': {
            'bravo.dyndns.example.com.': {
                'aws_region': 'us-east-1',
                'zone_id': 'ZONEID1234',
                'record': {
                    'ttl': 60,
                    'type': 'A',
                },
                'last_update': None,
            },
        },
    },
}
reelsense commented 7 years ago

I'm kind of cargo-culting my way into making this work. Thank you for the resources, I should try to RTFM.

Link a bitcoin address or something. I would like to thank you for your work!

sTywin commented 7 years ago

That's really not necessary, but if you feel so inclined: 1FFRhWijhNLn7hH8c2eAMtA7qTAp8Padyy

Good luck, let me know if you run into any other issues.

reelsense commented 7 years ago

This should cover a couple months of coffee...